Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
How to start Excel with a speific file in VFP?
Message
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Miscellaneous
Thread ID:
00353059
Message ID:
00353360
Views:
18
>>I want to click a buttom to lunch Excel with a excel document which a get from getfile().
>
>In the click event of the button:
>
>lcFilename = GETFILE()
>
>IF !EMPTY( lcFileName )
> oShell = CREATEOBJECT( "Shell.Application" )
>
> oShell.Open( lcFilename )
>ENDIF
>
>This uses the Windows Script Host (WSH), which has become a hot topic on the UT. If you have any questions about it, do a search for WSH.

No, this is using the Shell object, which is not a part of WSH, but is an automation object completely independent of WSH (the real requirement is the presense of an Active Desktop compliant shell on the system) and requires that older non-compliant OS releases to install IE4 or apply service patches to get the missing pieces.

The Open method of the Shell.Application object is doing the equivalent of launching the document with ShellExecute(), although it can do more since it will create an InternetExplorer.Application object instance if you launch a folder with it. For this use, either the _ShellExecute() class from the VFP6 FFC or using the ShellExecute() API call (there are about 8.7 billion examples of this on UT in the past, and at least one in the FAQ) will work just fine.
EMail: EdR@edrauh.com
"See, the sun is going down..."
"No, the horizon is moving up!"
- Firesign Theater


NT and Win2K FAQ .. cWashington WSH/ADSI/WMI site
MS WSH site ........... WSH FAQ Site
Wrox Press .............. Win32 Scripting Journal
eSolutions Services, LLC

The Surgeon General has determined that prolonged exposure to the Windows Script Host may be addictive to laboratory mice and codemonkeys
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform