
03-30-2001, 08:55 AM
|
|
Verbose Coder
Retired Moderator * Guru *
|
|
Join Date: Dec 1999
Location: Phoenix, Arizona
Posts: 3,011
|
|
Re: Open file
|
If all you want to do is display an excel file you could use the ShellExecute API call. In the general declarations section of your form put this:
<PRE> Private 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</PRE>and in your button you'd do something like this:
<PRE> Private Sub Command0_Click()
Dim lngResult As Long
Dim strDocument As String
' Change the path below to something appropriate for you.
strDocument = "e:\development\test.xls"
lngResult = ShellExecute(Me.hwnd, "Open", strDocument, "", "", vbNormalFocus)
End Sub</PRE>If you actually want to open an excel file and manipulate it'd help if you are more specific about what you want to do.
Hope this helps,
Paul
|
|