-
I keep getting the error:
Compile Error
Constants, fixed lenght strings, blah blah and Declare Statements are not allowed as Public Members of Object Modules!
How do i fix it?
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
Private Sub Check2_Click()
Dim retval As Long ' return value
Dim x As Integer
x = "F:\R S G\masters\RSG Jobs\job numbers listing.xls"
' 1. Run the program:
retval = ShellExecute(Form1.hwnd, "open", x, "-fast", "C:\MyProg\")
End Sub
Private Sub Command1_Click()
Dim retval As Long ' return value
Dim x As Integer
x = "F:\R S G\masters\RSG Jobs\job numbers listing.xls"
' 1. Run the program:
retval = ShellExecute(Form1.hwnd, "open", x, "-fast", "C:\MyProg\")
Check1.Value = 1
End Sub
-
put your api's in a .bas module
-
Yeah, Lethal is correct because you cant make a public declaration in a form.
-
I moved this:
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
to a module but when i run my code i get this error:
"Compile Error Arguement not optional."
Then it highlights then ShellExecute line of code in my form! Not the module
????????????????????
-
That is because you left out some parameters while calling th ShellExecute Command. If a cetain parameter is not optional, you must fill it out.
-
Public to private
If one form, change public to private in the general section... best in a BAS (public)
-
Am i dumb or am i dumb?
thanks
-
Not dumb, just not aware of the proper use. I bet you probably wont make the same mistake again. :D