
Newbie: Compile error: Argument (ShellExecute) not optional
When you read the error message, what did you think the problem was? If you
count the number of parameters in the declaration, you will find 6. If you
count the number of arguments in your function call, you will find 5. There's
one missing. It's the Operation string. Change the function call to:
RetVal = ShellExecute(Me.hwnd, "open", App.Path & _
"\movies\sisside1.rm", vbNullString, vbNullString, 1) ' Run Movie.
Lee Weiner
weiner AT fuse DOT net
Quote:
>When compiling Ed's code (below) I get the following error: Compile error -
>Argument not optional. It is the ShellExecute argument that is highlighted.
>Any ideas?
>Ed Phillippe's code:
>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
>Private Sub Command1_Click()
>Dim RetVal As Long
>RetVal = ShellExecute(Me.hwnd, App.Path & _
>"\movies\sisside1.rm", vbNullString, vbNullString, 1) ' Run Movie.
>End Sub