fits with Word 2003 and a macro

S

Suzette

I have a macro in a .dot file. The .dot file is set up as an add-in in
Word. I have not had any problems with Word 2000 or lower. Now with 2003 I
get a weird error but only when the .dot is an add in. This does NOT
happen while I'm testing by having the .dot file open.

The macro opens a document that it is supposed to modify and save under a
different name. It works perfectly if I open the .dot file and run the
macro. When Word is loaded normally with the .dot file as an add in, I get
the message that Word cannot be closed because a dialog screen is open.
There is a form that is open during this time.

How it works: I have a form that opens, the user enters information then
clicks finish. I goes to this bit of code:

System.PrivateProfileString("CMC.ini", "Report Info", "STTransID") =
..txtTransID
StatusBar = "Creating Report"
Documents.Open strDr & strDir & "\Stevens.doc", False, True, False

After that, the "Stevens.doc" is modified and saved under a different name.
Right after the Documents.open line, the error message appears. I tested
this by putting a messagebox as the next line of code. Any ideas? Also
to repeat, this works fine in older versions of Word.

Thank you.
 
C

Cindy M -WordMVP-

Hi Suzette,
The macro opens a document that it is supposed to modify and save under a
different name. It works perfectly if I open the .dot file and run the
macro. When Word is loaded normally with the .dot file as an add in, I get
the message that Word cannot be closed because a dialog screen is open.
There is a form that is open during this time.

How it works: I have a form that opens, the user enters information then
clicks finish. I goes to this bit of code:

System.PrivateProfileString("CMC.ini", "Report Info", "STTransID") =
..txtTransID
StatusBar = "Creating Report"
Documents.Open strDr & strDir & "\Stevens.doc", False, True, False

After that, the "Stevens.doc" is modified and saved under a different name.
Right after the Documents.open line, the error message appears. I tested
this by putting a messagebox as the next line of code. Any ideas? Also
to repeat, this works fine in older versions of Word.
And what is in this code line, that you don't show us?

Is the UserForm in question modal, or non-modal? And have you hidden it at
this point, or is it still open on the screen?

It would also be helpful to see how you're initiating, displaying and cleaning
up after the userForm.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :)
 

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