Command line start...

W

wwg

I may be in the wrong newsgroup with this query, if so I apologize.

Here's my problem.
To open a Word document from a MS/Access application I use a statement
similar to the following (the directory specs are OK):

Call C:\Microsoft Office\Winword\winword.exe C:\Data\Myfile.doc

It works great with Word 6 and Word 97, on Win95 & 98 but I get a "file not
found" with word 2k on NT. The files are indeed in the specified
directories. It seems to be looking for Myfile.doc because winword opens if
I remove the file specification.

Any idea why it should fail on Word 2K under NT?

-- Wesley
 
C

Cindy M -WordMVP-

Hi Wwg,
To open a Word document from a MS/Access application I use a statement
similar to the following (the directory specs are OK):

Call C:\Microsoft Office\Winword\winword.exe C:\Data\Myfile.doc
Look up the SHELL command in the Access VBA Help. I think if you use
Shell instead of "Call" it should work. Do remember that you need to put
the path to winword.exe and the path to the document in their own sets
of "quotes" if they contain any spaces.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Sep 30 2003)
http://www.mvps.org/word

This reply is posted in the Newsgroup; please post any follow question
or reply in the newsgroup and not by e-mail :)
 
W

wwg

Cindy:

Thanks for your prompt reply and suggestion. As it happens I erred in my
posting, I do use Shell not Call -- as I noted, this Access app has worked
fine for years with Word 6 and 97 on Win95 and 98. One more clue, on the NT
machine the command line .doc initiation does not even work from the
Start/Run dialog. It produces the "file not found" diagnostic also.

--Wesley
 
J

Jay Freedman

Hi, Wesley,

One difference between Win95/98 and WinNT/2000/XP is that the latter
can have access permissions set on each folder. If the user running
the Shell command doesn't have browse rights to the folder that
contains the document file, you'll get the "file not found" error when
you try to access it. This isn't very probable, but it's worth
checking.
 
L

Lars-Eric Gisslén

wwg,

Just a wild shot, have you tried
Call "C:\Microsoft Office\Winword\winword.exe" C:\Data\Myfile.doc
 
W

wwg

The quotes did it! Interesting that they were not necessary in previous
versions.

Thanks Lars. And also to Cindy and Jay.

--Wesley
 
J

Jonathan West

wwg said:
The quotes did it! Interesting that they were not necessary in previous
versions.

Thanks Lars. And also to Cindy and Jay.

Quotes are needed if there is a space in the path name.
 

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