|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
ShellExecute errorI have the following code: Option Compare Database 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 Integer) As Long Private Sub Command86_Click() r = ShellExecute(0, "open", "C:\Windows\System32\Notepad.exe", "", "C:\", 1) End Sub When I click the button, I get the following error message: "The expression On Open you entered as the event property settings produced the following error: constants, fixed-lenght strings, arrays, user defines types and Declare statments are not allowed as Public members of object modules" Can I have some help, please? Thanks H. Martins H. Martins wrote:
> Public Declare Function ShellExecute Lib "Shell32.dll" . . . The last part is the important one ...> Private Sub Command86_Click() > r = ShellExecute(0, "open", "C:\Windows\System32\Notepad.exe", "", > "C:\", 1) > End Sub > "The expression On Open you entered as the event property settings > produced the following error: constants, fixed-lenght strings, arrays, > user defines types and Declare statments are not allowed as Public > members of object modules" "... Declare statements are not allowed as Public members ..." Make the "Declare Function" Private and you should be OK. Private Declare Function ShellExecute Lib "Shell32.dll" . . . HTH, Phill W. |
|||||||||||||||||||||||