Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Microsoft Word - Print as PDF - Normal.dot error

Status
Not open for further replies.

Phantek

Programmer
Apr 25, 2011
29
US
Hey everyone,

Short version:

VBA code in Access to fill two Word forms then save them as PDF. Getting an error that "normal.dot" is in use when second Word file is opened.

Long version:

I have a small program set up in Microsoft Access to take a selected record, copy the information into a Microsoft Word form, and then "Print" the form as a PDF.

The problem I am having is that I sometimes need to create two separate PDF files from two different Word documents. I have no trouble opening up the files and filling in the forms, but the trouble arises when I try to print as PDF.

The code is currently set to open one Word file, complete it, print it as PDF, close it, and then repeat with the second file. The problem that arises is that the second Word file tries to open before the first has completely closed. The result is that I get an error message saying that Normal.dot is in use and a prompt to save the file.

I managed to get around this by building in a time delay between the close of the first and the opening of the second file, but that is a bit of a messy fix.

Is there any way around this? Ideally it would be some way to expedite the printing where both Word files can be open at once, but alternatively it would help to detect when the first version of Word is closed down before the second document opens.

Any suggestions? Thanks in advance for your help!
 
Hi Phantek,

I suspect the reason the first file hasn't closed is that Word hasn't finished creating the PDF from it. Assuming that's the case, you could implement a loop that tests for the existence of the PDF before closing the corresponding document.

Cheers
Paul Edstein
[MS MVP - Word]
 
Great suggestion, I will try that out - thanks Paul.

Any ideas related to how to have both Word documents open at the same time and not get the normal.dot error?
 
Hi Phantek,

I don't see nay reason why you can't have multiple documents open at the same time. Have you tried that without invoking the print routine?

Cheers
Paul Edstein
[MS MVP - Word]
 
You are right Paul, it works fine when I open multiple documents right up until I invoke the print routine - it is at that moment that things go sour.
 
Hi Phantek,

In that case, it should just be a matter of implementing the test I wrote about, before trying to PDF the second document.

Cheers
Paul Edstein
[MS MVP - Word]
 
Unfortunately, the loop test is not working. It appears as though the program is able to confirm that the PDF document exists prior to the first instance of Word being able to shut down entirely, thus causing a continuation of the normal.dot error.
 
Hi Phantek,

Why are you using two instances of Word? Why do process both documents in the same instance?

Nevertheless, if you want to use two instances, the logical approach would be to test whether the frst one has closed (eg via a loop) before starting the second one.

Cheers
Paul Edstein
[MS MVP - Word]
 
I was having the same problem when I used a single instance of word, but two documents. The only way I was able to get around it was by using two instances and delaying in the middle.

The good news is that this has been resolved. Thanks for your help Paul, as it helped me narrow down where the problem was. It turns out the problem was with the way I was closing the document. Originally, I was using:

objWord.ActiveDocument.Close SaveChanges:=wdDoNotSaveChanges
objWord.Quit

Interestingly, all the problems were resolved if I changed it for this:

objWord.Quit SaveChanges:=wdDoNotSaveChanges
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top