|
-
Dec 24th, 2004, 06:21 PM
#1
Thread Starter
Member
(Resolved) Help with Browser from Button Code...
Ok, I have noticed that this code:
VB 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 Const SW_SHOWNORMAL = 1
Private Sub Command1_Click()
ShellExecute Me.hwnd, vbNullString, "http://www.microsoft.com/", vbNullString, "C:\", SW_SHOWNORMAL
End Sub
End Sub
Returns this error statement when I go to compile it:
"Only comments may appear after End Sub, End function, or End Property"
and then it highlights this part:
VB 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
Why am I receiving this message? What did I do wrong? Please help - Thanks
Last edited by The Dude45; Dec 24th, 2004 at 11:48 PM.
-
Dec 24th, 2004, 06:23 PM
#2
Re: Help with Browser from Button Code...
You have 2 (two) "End Sub"s so remove one:
VB 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 Const SW_SHOWNORMAL = 1
Private Sub Command1_Click()
ShellExecute Me.hwnd, vbNullString, "http://www.microsoft.com/", vbNullString, "C:\", SW_SHOWNORMAL
End Sub
-
Dec 24th, 2004, 06:30 PM
#3
Thread Starter
Member
Re: Help with Browser from Button Code...
Ok, I removed the extra End Sub and I still receive the error message - ugh everyone else seems to be able to get it to work
-
Dec 24th, 2004, 07:03 PM
#4
Re: Help with Browser from Button Code...
Open your code window and select Full Module View (little button at the left bottom corner) and check what you have there - you should only have one procedure header and one footer:
Private Sub Command1_Click()
End Sub
If you see End Sub following by another End Sub (or some other garbage) then simply get rid of that ...
-
Dec 24th, 2004, 10:38 PM
#5
Thread Starter
Member
Re: Help with Browser from Button Code...
Ok I will post what is above and below the code, because I still have the problem:
VB Code:
Private Sub About_Click()
AboutthisProduct.Show
End Sub
Private Sub Continue_Click()
ChooseMode.Show
Opening.Hide
End Sub
Private Sub Update_Click()
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 Const SW_SHOWNORMAL = 1
Private Sub Command1_Click()
ShellExecute Me.hwnd, vbNullString, "http://www.microsoft.com/", vbNullString, "C:\", SW_SHOWNORMAL
End Sub
That's everything that is in the currently selected frame within the form. I don't know if it being inside a frame has anything to do with it, but there you have it. Thanks!
-
Dec 24th, 2004, 10:47 PM
#6
Re: Help with Browser from Button Code...
Get rid of this line:
Private Sub Update_Click()
You probably had this button at some point or perhaps still do but it's useless I guess.
-
Dec 24th, 2004, 10:51 PM
#7
Thread Starter
Member
Re: Help with Browser from Button Code...
Man I don't wanna seem like a pain, but deleting that line connects the Private Sub Contine_Click section with the "Update" browser button. The error continues to appear. Should I remove the frame or something?
-
Dec 24th, 2004, 11:05 PM
#8
Re: Help with Browser from Button Code...
The declaration statements for the API and the constant must appear in the "general declarations" section of the form (i.e., prior to any Sub or Function). Rearrange your code as follows:
VB 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 Const SW_SHOWNORMAL = 1
Private Sub About_Click()
AboutthisProduct.Show
End Sub
Private Sub Continue_Click()
ChooseMode.Show
Opening.Hide
End Sub
Private Sub Command1_Click()
ShellExecute Me.hwnd, vbNullString, "http://www.microsoft.com/", vbNullString, "C:\", SW_SHOWNORMAL
End Sub
"It's cold gin time again ..."
Check out my website here.
-
Dec 24th, 2004, 11:10 PM
#9
Thread Starter
Member
-
Dec 24th, 2004, 11:19 PM
#10
Re: Help with Browser from Button Code...
Glad to help. Merry Christmas!
BTW - I see that you are new to the forum. The moderators have instituted a new convention to indicate that the issue has been resolved. What you do is edit your original post to show the green checkmark icon.
"It's cold gin time again ..."
Check out my website here.
-
Dec 24th, 2004, 11:47 PM
#11
Thread Starter
Member
Re: Help with Browser from Button Code...
Merry Christmas to you too! Thanks for the tip ====>Will do
-
Dec 25th, 2004, 12:53 AM
#12
Re: (Resolved) Help with Browser from Button Code...
sub Update_Click
didn't have an End Sub, anyways.
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
|