Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / November 2006

Tip: Looking for answers? Try searching our database.

How can I programmatically save a document

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Micheline - 06 Nov 2006 18:33 GMT
How can I programmatically save a document once I have detached it from the
original template it was created?

The code does work only if… the Original template is open at the time, then
the detached document gets saved programmatically.

The reason why I need this functionality is because I don’t want the macros
on the customized toolbar to be available once the document is completed)

For now, if I detach the template, the document needs to be saved (i.e. the
user gets prompted to save), the ActiveDocument.Save does not get executed.

See code:

ActiveDocument.AttachedTemplate = ""
ActiveDocument.Save

Hope someone can help me and thanks very much.
Jezebel - 06 Nov 2006 21:02 GMT
1. Every document has an attached template. The only thing you can change is
which one. This instruction

ActiveDocument.AttachedTemplate = ""

has the same effect as

ActiveDocument.AttachedTemplate = "normal.dot"

2. The Save instruction has no effect if the document is already saved,
meaning .Saved = true. You can test what's going on in the immediate
window --

[do instruction]
? ActiveDocument.Saved

... if the answer is 'true' then your instruction had no effect. You can
force the issue by setting .Saved = FALSE

However, ...
If your save instruction is not working following your .AttachedTemplate =
"", that suggests that the document is already attached to normal.dot. In
which case you can't detach it (unless you attach it something else); but if
your code and toolbar are part of normal.dot, you're going to get them
anyway.

> How can I programmatically save a document once I have detached it from
> the
[quoted text clipped - 19 lines]
>
> Hope someone can help me and thanks very much.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.