|
-
January 25th, 2000, 11:24 AM
#1
opening up a file
Hello
I've made a programme that creates a file and then saves it ( according to some name the user has entered) to the desktop. What I want is to create a short cut to opening up the file from the main form. At present I've tried inserting a view command on the form but each method I've tried creates errors! Its probably something really simply but any suggestions would be great.
Thanks in advance
-
January 25th, 2000, 02:13 PM
#2
Re: opening up a file
If you know the location of the file (the full path) then you could use the ShellExecute API to have windows open that file in it's associated program. (ie .doc files open in Word etc). here is the API code...
public Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _
(byval hwnd as Long, byval lpOperation as string, _
byval lpFile as string, byval lpParameters as string, _
byval lpDirectory as string, byval nShowCmd as Long) as Long
public Const SW_SHOWNORMAL = 1
'call it like this:
'now display the excel spreadsheet
Dim fn as string
fn = App.Path & "\myxlsfile.xls"
iRetVal = ShellExecute(me.hwnd, vbNullString, fn, vbNullString, "c:\", SW_SHOWNORMAL)
I hope this helps,
john
John Pirkey
MCSD
www.ShallowWaterSystems.com
John Pirkey
MCSD (VB6)
http://www.stlvbug.org
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|