|
-
Mar 20th, 2001, 10:07 PM
#1
Thread Starter
PowerPoster
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
-
Mar 20th, 2001, 10:08 PM
#2
PowerPoster
put your api's in a .bas module
-
Mar 20th, 2001, 10:26 PM
#3
Yeah, Lethal is correct because you cant make a public declaration in a form.
-
Mar 20th, 2001, 10:28 PM
#4
Thread Starter
PowerPoster
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
????????????????????
-
Mar 20th, 2001, 10:32 PM
#5
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.
-
Mar 20th, 2001, 10:47 PM
#6
PowerPoster
Public to private
If one form, change public to private in the general section... best in a BAS (public)
Remaining quiet down here !!!
BRAD HAS GIVEN ME THE ULTIMATIVE. I have chosen to stay....
-
Mar 20th, 2001, 10:53 PM
#7
Thread Starter
PowerPoster
Am i dumb or am i dumb?
thanks
-
Mar 20th, 2001, 10:55 PM
#8
PowerPoster
Not dumb, just not aware of the proper use. I bet you probably wont make the same mistake again.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|