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!

Shellexecute to open a Word.doc - no reaction 1

Status
Not open for further replies.

Koen Piller

Programmer
Jun 30, 2005
841
NL
Hi,

I would like to open a word.doc in my VFP application and have therefore constructed:
Code:
DECLARE INTEGER SellExecute in Shell32.dll ;
INTEGER hhdWin, ;
STRING cAction, ;
STRING cFileName, ;
STRING cParams, ;
STRING cDir, ;
INTEGER nShowWin

lcFileName = "myWord.DOC"
= shellexecute(0,"open",lcFilename,"","",1)
And nothing, virtualy nothing, happens.
So I replaced lcFilename with
Code:
SYS(5)+SYS(2003)+"\archief\myWord.doc"
still nothing

needless to say.
- Word is installed on this PC
- Directory archief is found in my path
- File myWord.DOC resides in SYS(5)+SYS(2003)+"\archief"

What possibilities do I have to correct this unwanted behavior?

Regards,

Jockey(2)
 
> it's interesting that when Jockey double-clicked on the file, Word was successfully opened
This is puzzling, but to me it only shows there are at least two places in the registry about file associations, that are normally in sync.
Scotts experiment of associating DOC with Wordpad and back to MS Word shows this is related, but Jockeys error shows its separate, too.

Bye, Olaf.
 
I may have overlooked it, but I haven't seen anyone address the actual pathing problem in the first post. SheellExecute needs to know where the file is and I have found that prefacing the filename with the path doesn't always work. It has always worked better for me to use the 'path' parameter:

Code:
DECLARE INTEGER SellExecute in Shell32.dll ;
INTEGER hhdWin, ;
STRING cAction, ;
STRING cFileName, ;
STRING cParams, ;
STRING cDir, ;
INTEGER nShowWin

lcFileName = "myWord.DOC"
[COLOR=blue]lcPath = SYS(5)+SYS(2003)+"\archief" [/color]
= shellexecute(0, "open", lcFilename, "", [COLOR=blue]lcPath[/color], 1)


-Dave Summers-
[cheers]
Even more Fox stuff at:
 
Hi,

Sorry, overlooked to inform about my test to open Word.doc in the same application, same document, on an other PC with shellexecute():
No problem. Works like a charm.
Remains the puzzle what made it unworkable on the first pc?
I am afraid, this will never be solved.
Anyway changed my coding to be more defensive in case someone else using this application also faces a nonworkable shellexecute() for Word.

Thanks for moral support,

Jockey(2)
 
I already told you. Uninstall Word365 and repair teh "normal" Word version.
 
Jockey2,
Why can't you just reinstall the OS on the first PC, put the application back on it, and all should be fine.
Most likely your registry is baked. Mucking with the registry can be very difficult, and is beyond the scope of this forum (it's VFP, not Windows Registry forum)...
That's the simple route.
-S

Best Regards,
Scott
ATS, CDCE, CTIA, CTDC

"Everything should be made as simple as possible, and no simpler."[hammer]
 
Scott,

Will join the Windows Registry Forum, get disposed of that PC. Either or

To uninstall and re-install Word365 the route as proposed by Tore. Could be a possibility. Will check with MS first about the license.

Regards,
Jockey(2)
 
No, don't install Word365. Not unless you really need it....! But reinstalling it will most likely bring back the problem.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top