Creating a New Document from a Template

S

Steve Thresher

I am attempting to automate word 2003 so that it will create a new document
from a template, replace some text, and then save the new file to a
specified location. This all works ok apart from when another instance of
word 2003 is running in which case the automated copy, on exit, displays a
dialog titled 'Microsoft Office Word' which contains the text 'The file is
in use by another application or user. (C:\Documents and
Settings\...\Normal.dot)'. I have tried changing the value of the
DisplayAlerts property to none but it hasn't made any difference. Can
anybody suggest what the problem is?
 
J

Jonathan West

Hi Steve,

Yes, the problem is that something in your macro is changing normal.dot.

2 possible approaches.

1. Work out what you program is doing that is changing normal.dot and get it
to stop.

2. Set the NormalTemplate.Saved property to true, to fool Word into thinking
that normal.dot hasn't been changed.
 
S

Steve Thresher

The act of creating a new document from a template seems to be enough to
make Word think normal.dot has been modified. Therefore I'll try option 2.
I'm doing things the hard way (as always) and using C++ to retrieve
IDispatch interfaces to represent the word object and then using
GetIDsOfNames() and Invoke() methods to create and modify a document. Can
you tell me where is the NormalTemplate.Saved property in the object model?
Also do you know of a good reference to the entire object model,
particularly the parameter lists for the various functions?
 
J

Jonathan West

Steve Thresher said:
The act of creating a new document from a template seems to be enough to
make Word think normal.dot has been modified. Therefore I'll try option 2.
I'm doing things the hard way (as always) and using C++ to retrieve
IDispatch interfaces to represent the word object and then using
GetIDsOfNames() and Invoke() methods to create and modify a document. Can
you tell me where is the NormalTemplate.Saved property in the object
model?

NormalTemplate is a property of the Word Application object.
Also do you know of a good reference to the entire object model,
particularly the parameter lists for the various functions?

The Word VBA Help file contains a description of the Word object model and
of each object, property, method and event within the object model.
 
S

Steve Thresher

Thanks for the info. Very much appreciated.

Jonathan West said:
model?

NormalTemplate is a property of the Word Application object.


The Word VBA Help file contains a description of the Word object model and
of each object, property, method and event within the object model.


--
Regards
Jonathan West - Word MVP
www.intelligentdocuments.co.uk
Please reply to the newsgroup
 

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