Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Best way to view an Excel worksheet?
Message
General information
Forum:
Visual FoxPro
Category:
Windows API functions
Miscellaneous
Thread ID:
00048405
Message ID:
00048431
Views:
24
>What is the best way to view a spreadsheet? I'm currently using a "RUN" command followed by the file name but this displays the "Foxrun" command window (big black box).
>
>Is there another, more elegant way to do this?
>
>Thanks in advance

Here is a copy of a previous thread about starting the default
web browser from VFP.

You only need to change the URL in this exemple
to the path and name of your exel sheet

cut--------
************
*You can look at the win32api help for more details

*You can place this code on a button click event

* This code was used to start the default browser and to navigate
* to the URL placed in var "MonURL"

*If i place a URL to an 'HTM' or an 'HTML' file windows start the default
*browser associate with this extention.
*It works like a double-click on a file in explorer

MonURL="http://www.total.net/~gersan/index.htm"

* or you can place a 'Mail' URL to start the
* default Email program (ex. MonURL = "mailto:gersan@total.net")

DECLARE INTEGER ShellExecute ;
IN SHELL32.dll ;
INTEGER nWinHandle, ;
STRING cOperation, ;
STRING cFileName, ;
STRING cParameters, ;
STRING cDirectory, ;
INTEGER nShowWindow

**retreive the main VFP window handle (this handle is used by ShellExecute)

DECLARE INTEGER FindWindow ;
IN WIN32API ;
STRING cNull, ;
STRING cWinName

z=ShellExecute(FindWindow( 0, _SCREEN.caption), "Open", MonURL, "", "c:\temp\", 1)

**Error messages if the return value is < 32

IF z < 32
DO CASE
CASE z=2
Wait wind "Bad association or invalid URL , oops!"
CASE z=31
Wait wind "No association , oops!"
CASE z=29
Wait wind "Can't start the application, oops!"
CASE z=30
Wait wind "The application is already started, oops!"
ENDCASE
ENDIF

*************************
;)
cut------

HTH
:)
If we exchange an apple, we both get an apple.
But if we exchange an idea, we both get 2 ideas, cool...


Gérald Santerre
Independant programmer - internet or intranet stuff - always looking for contracts big or small :)
http://www.siteintranet.qc.ca
Previous
Reply
Map
View

Click here to load this message in the networking platform