Closing write protected word document

  • Thread starter Thread starter hufflehuffle
  • Start date Start date
H

hufflehuffle

Hi!

I am launching a word "serial letter" from access. The new document is
created correctly. When I try to close the template document (which is
write protected) using

objWord.close wdDoNotSaveChanges

I always get asked where to save the document (although I asked not to
save changes).

Can this be avoided?
Thanks for your ideas.
Best regards,
Andreas
 
Hi Andreas,

1) What is the value of wdDoNotSaveChanges at this point in your code?
It needs to be 0 or False (I find it easier just to pass True or False
in this argument rather than try to remember the names of the Word
constants).

2) If that's not the answer, is it possible that something you've done
has created another document, or modified a template, without your
noticing?
 
John said:
Hi Andreas,

Hi, John,

thanks for your answer.
1) What is the value of wdDoNotSaveChanges at this point in your code?
It needs to be 0 or False

It actually is 0.
(I find it easier just to pass True or False
in this argument rather than try to remember the names of the Word
constants).

I have been advised to use predefined constant names since the
beginning of my programming in any language, just to cover future
changes... Is this wring?
2) If that's not the answer, is it possible that something you've done
has created another document, or modified a template, without your
noticing?

The target of that serial letter is set to "New Document", so a second
document is created in the process. Then the macro tries to close the
template to prevent the user from messing around with it. There the
request for a filename occurs.

Should'nt wdDoNotSaveChanges prevent this request even _if_ a macro
changed the template in the process?

Best regards,
Andreas
 
Back
Top