4160 bad file name

B

Buta Singh

Hello

I have a situation that has me stumped. I have started
getting a Run-time error '4160' - bad file name in a
macro that was working fine yesterday and for the past 3
years!!!! I am running in W2K server and word 2002. This
is the code that causes the problem and is part of
autoOpen

DocPath = DocDrive & DocDir & "\" & DocFile
Set prop = ActiveDocument.BuiltInDocumentProperties
prop(wdPropertyHyperlinkBase) = DocDrive & DocDir
Application.Documents(DocPath).Saved = True

The actual line that causes the problem is the last line
Application.Documents(DocPath).Saved = True

I checked and double checked the path and it is correct. I
also recreated the normal.dot file to no avail. I can make
changes to the DocPath file.

Any suggestions would be dearly appreciated. Thank you in
advance.

Regards,

Buta
 
W

Word Heretic

G'day "Buta Singh" <[email protected]>,

the contents of DocPath are ok when it breaks?


Buta Singh said:
Hello

I have a situation that has me stumped. I have started
getting a Run-time error '4160' - bad file name in a
macro that was working fine yesterday and for the past 3
years!!!! I am running in W2K server and word 2002. This
is the code that causes the problem and is part of
autoOpen

DocPath = DocDrive & DocDir & "\" & DocFile
Set prop = ActiveDocument.BuiltInDocumentProperties
prop(wdPropertyHyperlinkBase) = DocDrive & DocDir
Application.Documents(DocPath).Saved = True

The actual line that causes the problem is the last line
Application.Documents(DocPath).Saved = True

I checked and double checked the path and it is correct. I
also recreated the normal.dot file to no avail. I can make
changes to the DocPath file.

Any suggestions would be dearly appreciated. Thank you in
advance.

Regards,

Buta

Steve Hudson

Word Heretic, Sydney, Australia
Tricky stuff with Word or words for you.
Email: (e-mail address removed)
Products: http://www.geocities.com/word_heretic/products.html
Spellbooks: 728 pages of dump left and dropping...

The VBA Beginner's Spellbook: For all VBA users.
 

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