Word Document and Template saving issue

W

WAFDOF

I have created a short template in Microsoft word. In this template are
several bookmarks. The template was saved with the .DOT extension.

Using Visual Studio 2005 VB.net I access the template to create a document
via the following command line:
wdDoc = wdApp.Documents.Add("C:\Program Files\dot\AccPkg\maintrans3.dot")

Works great. I run the macro from VB.net without difficulty. What I have
run into recently is an issue where when I save the newly created word
document (document1.doc) MS Word then prompts me if I want to save the .DOT
file.

I have used this for sometime and it has only started asking about the .dot
file save recently. Somehow I have associated the Document changes back to
the template. Can someone point me in a direction where I may be able to
break that association? When the document (.doc) file is saved there should
be no questions about the .dot being saved.

Whatever I did seems to be in MS Word and with that particular template
because I use other templates just fine in the same program and the MS Word
prompt to save the .dot file only shows up after I have saved the .doc file

Ken
 
B

Bear

WAFDOF:

Do you have any toolbars or command buttons in your template macros? If
you're changing the images of those (say when the user clicks one) then
you've changed the template.

Try adding this code at the end of your button-changing macro:

~~~
ThisDocument.Saved = True
~~~

ThisDocument refers to the template. You're telling Word that you already
saved the "change" so it won't prompt the user. Be careful, though, because
now you can inadvertently discard hours of code editing if you click the
wrong button and close without remembering to save.

Bear

Windows XP, Word 2000
 
W

WAFDOF

Hey Bear.... Actually the template is a memorandum with 7 bookmarks. I wrote
a Macro that creates new bookmarks as needed and puts text with those
bookmarks. The Document comes out great. But as far as I know there is
nothing being written or changed with the actual template....

I will try your suggestion.....nothing to lose really as the template is
backed up.

Thanks for your quick reply!!
 
W

WAFDOF

Your suggestion worked just fine Bear, thank you. When you mentioned
changing the imagine I went back and discovered I had a listbox hidden on the
form that the macro would fill up then empty. So that was where the change
was taking place. Saving the template with your suggestion made no change to
the template since the listbox was once again empty at that point.


Thanks for your quick response!!

WAFDOF
 
W

WAFDOF

Bear I spole too soon. The SaveAS was working on the .doc file. So I am
still back at the original issue. My co-worker was with me when I created
this particular template and he recalls that a prompt came up asking if I
wanted to assocaite the template with the document....and I had clicked yes.
(Wish I could remember that!!)

So is there a way to break that assoication? Using Word 2003.

WAFDOF
 
B

Bear

WAFDOF:

Sorry, but you've got me confused.

ThisDocument.Saved = True

Should be saving the attached template.

Try putting a breakpoint (F9) on that statement and making sure it's working
that way...

The whole point is to allow changes to your template, but then to ignore
them and tell Word it's already saved when you close the dependent document,
right?

Bear
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top