page counting macro works one day, but not the next

M

MoGH

In a previous post, I asked about methods for linking separate files into a
single document with a single TOC. I was directed away from using Master
documents, and towards using the {RD \f} feature.

This appears to work just fine. I insert the bracket(s), type in the file
name(s), generate the TOC. Of course each file starts page numbering at 1.
From this point, it was a short jump to using a macro created to count the
number of pages in a document and key off of that. I did not devlope this
macro but am using the one provided in the article

http://pubs.logicalexpressions.com/Pub0009/LPMArticle.asp?ID=148

Here's my problem. It works great, at first. I open and close the main
document, happily add more documents, generate a new TOC, update the page
numbers, save, close, open, etc. Then I go home for the day. The next day,
when I try to run the macro (yes, I enabled macros upon opening the
document), having made no changes in any of the documents, the macro won't
run. It hangs up on the first document with the following:

Runtime error '5174'
file could not be found
check spelling, try different file name, etc

File names did not change from the previous day. Removing the first file
from the {RD} list doesn't solve the problem. The debugger doesn't help at
all, showing a stop at this line in the macro:

Set oDoc = Documents.Open(FileName:=strCode)

If I remove all the RD coding, and start over, it all works again, until the
next day, when the whole error cycle begins again.

Whats going on and how do I fix it?
 

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