As I suspected it's not the code. The problem has to do with the kind of
picture it is (Shape, not InlineShape). Does anyone have any idea why trying
to use wdDoNotSaveChanges with a document that contains a Shape (*not* an
InlineShape) would trigger a message asking whether you want to save changes?
To reproduce the problem:
1. insert a picture from a file into a document
2. right click on the picture
3. choose Format Picture from the popup menu
4. click on the layout tab and make sure the Wrapping Style on the Layout
tab is *not* "In line with text"
5. click OK on the Format Picture dialog
6. save and close the document
7. open the document and run the following sub
Sub CloseNoChangeTest()
ActiveDocument.Close wdDoNotSaveChanges
End Sub
Hi Chuck,
I did exactly as you said and called the sub in command button click, and
didn't get any message box. I put that code in the cancle button of the user
form also but the message box didn't show up.
If you can just tell in which event you calling the code, it might be helpful.
Chuck - 20 Apr 2005 11:03 GMT
Thanks for trying and I don't understand why you're not getting the results
I'm getting because I tested the steps I outlined repeatedly. The only code
necessary to reproduce the behaviour is the single line of code that I
provided -- so posting more code won't be helpful. Did you make sure that the
image is not in-line? That's the crucial point, not where the code is called
from (ie it doesn't matter whether you run the single line
Activedocument.Close wdDoNotSaveChanges from a button on a form or from
Tools>Macros or from within the VBE.
I'm working in Word 2000 SP3 on Win 2000.
> Hi Chuck,
>
[quoted text clipped - 3 lines]
>
> If you can just tell in which event you calling the code, it might be helpful.
Anand.V.V.N - 25 Apr 2005 06:23 GMT
Hi Chuck,
I made sure that the image is not in-line. Could it be the way word is
handling the images?
Anand
> Thanks for trying and I don't understand why you're not getting the results
> I'm getting because I tested the steps I outlined repeatedly. The only code
[quoted text clipped - 14 lines]
> >
> > If you can just tell in which event you calling the code, it might be helpful.
Chuck - 20 Apr 2005 11:07 GMT
By the way, I don't need code to reproduce the problem - if I simply close
the document with an image (NOT an inline image but with wrapping style set
to anything but inline) then I get the "do you want to save changes" message
box, even though I've not made any keystrokes; if the image is inline
however, I don't get the message box. So it's definitely a code issue but a
Word/Shape issue. I'll be switching discussion groups on this issue from now
on.
> Hi Chuck,
>
[quoted text clipped - 3 lines]
>
> If you can just tell in which event you calling the code, it might be helpful.
Anand.V.V.N - 25 Apr 2005 06:24 GMT
Hi Chuck,
Hope you can get a solution for you problem. All the best.
Anand
> By the way, I don't need code to reproduce the problem - if I simply close
> the document with an image (NOT an inline image but with wrapping style set
[quoted text clipped - 11 lines]
> >
> > If you can just tell in which event you calling the code, it might be helpful.