Message 1 of 3
API Calls

Not applicable
08-20-2000
01:11 PM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I have created a form with a command button. When click I can browse through the computer and selected an excel file. I need excel to open that file. Here is the code so far:
I get an error: User-defined type not defined, then the debugger goes to the Private Sub Navigate(frm As Form, ByVal document_name As String)
ShellExecute frm.hwnd, "open", document_name, "", "", SW_SHOW
Is there another way to do this? Or how do I fix the problem.
Private Sub Cmdbrowse_Click()
Dim FileName As String
CommonDialog1.Action = 1
FileName = CommonDialog1.FileName
Navigate Me, FileName
End Sub
' Invoke the application associated with a document type
Private Sub Navigate(frm As Form, ByVal document_name As String)
ShellExecute frm.hwnd, "open", document_name, "", "", SW_SHOW
End Sub
In the module:
Public Const SW_SHOW = 1
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
I get an error: User-defined type not defined, then the debugger goes to the Private Sub Navigate(frm As Form, ByVal document_name As String)
ShellExecute frm.hwnd, "open", document_name, "", "", SW_SHOW
Is there another way to do this? Or how do I fix the problem.
Private Sub Cmdbrowse_Click()
Dim FileName As String
CommonDialog1.Action = 1
FileName = CommonDialog1.FileName
Navigate Me, FileName
End Sub
' Invoke the application associated with a document type
Private Sub Navigate(frm As Form, ByVal document_name As String)
ShellExecute frm.hwnd, "open", document_name, "", "", SW_SHOW
End Sub
In the module:
Public Const SW_SHOW = 1
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