Word Automation - throws error 5174 opening file with '#' in filen

D

dymutaos

Bug Report (can't find out how to submit bug reports other than here)
Summary of bug - Word 2007 automation object throws error 5174 with any
filename that has the pound sign (#).

I have run into this bug only when using the Automation object for Microsoft
Word 2007. I have not tried this with other versions of Word.

The file I am opening is a "doc" file, NOT a "docx" or "docm". The filename
contains a pound sign (#). I am able to open this file using any other method
(File->Open; double-clicking from Windows Explorer; etc). But when opening
using a Word.Application object with the Documents.Open method, the script
throws the Error 5174, which is a File Not Found error. I am able to open any
other file with this same code, and only by removing the pound sign am I able
to open this file with the script.

Error 5174 (File Not Found) is stating that Word cannot find the file.
Because the file exists, and because Word is able to open the file using
other means, this error is being incorrectly generated.

Please fix the bug so that the Word automation object can handle files with
the pound sign correctly. Or, if the object cannot handle files with pound
signs in their filename, please create a new error message pertaining to the
real issue.

Thank you.

----------------
This post is a suggestion for Microsoft, and Microsoft responds to the
suggestions with the most votes. To vote for this suggestion, click the "I
Agree" button in the message pane. If you do not see the button, follow this
link to open the suggestion in the Microsoft Web-based Newsreader and then
click "I Agree" in the message pane.

http://www.microsoft.com/office/com...342f2e51&dg=microsoft.public.word.vba.general
 
F

Fumei2 via OfficeKB.com

"Please fix the bug so that the Word automation object can handle files with
the pound sign correctly. Or, if the object cannot handle files with pound
signs in their filename, please create a new error message pertaining to the
real issue."

Do you think you are writing to Microsoft here? Sorry, but that is not the
case.

BTW:

Set wdApp = CreateObject("Word.application")
Set wdDoc = wdApp.Documents.Open(Filename:="c:\zzz\Tues#day.doc")
wdApp.Visible = True

wdDoc.Close
Set wdDoc = Nothing
wdApp.Quit
Set wdApp = Nothing

works fine in Word 2002. It opens a file with # in it. This must be -
surprise - a 2007 issue.
 

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