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 gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Documents.Open file not found Office XP suite

Status
Not open for further replies.

Keenable

Programmer
Oct 29, 2001
3
US
I have tried many different ways to open an existing document via Access, for example...

Dim wordApp As Word.Application
Dim wordDoc As Word.Document

Set wordApp = CreateObject("Word.Application")
Set wordDoc = wordApp.Documents.Open(FileName:=docName)

...from Microsoft help, where docName is a string path file name. I always get error Run-time error '5174', this file could not be found. The very name of the file is displayed as not found, but it is really there. This is all local on my C:\ drive. My only hunch is that FileName happends to be a name of a database column, leaving out "FileName:=" does not help. I can't use the contents of db's FILENAME because it tells me it's not a string. Sure looks like a string filename to me...

Do I need to change the db column name? I have no idea why early or late binding or anything I try to open an existing file gives me the exact name of the file and "file not found."



 
Its strange but i think your problem are spaces in the name of your filename. I had a similar problem once but then with shell.
 
No spaces in the name. Doesn't work even when I try the following example on a different computer on a different database (where there's no conflict with FileName being also an column on a table). I get the same error:

Private Sub Command0_Enter()

Dim WordApp As Word.Application
Dim WordDoc As Word.Document

Set WordApp = CreateObject("Word.Application")
Set WordDoc = WordApp.Documents.Open(FileName:="c:\x.doc")
Set WordApp = Nothing
Set WordDoc = Nothing
End Sub


This is maddening. Especially frustrating is that intellisense works, and the filename, well, it's "correct." Must be something really simple. I have
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top