Tech Support Guy banner
Status
Not open for further replies.
1 - 8 of 8 Posts

·
Registered
Joined
·
165 Posts
Discussion Starter · #1 ·
I am writing a small app and in the About box, I want the user to be able to click on my website hyperlink (although it is just a label at the mo) and be taken there through the NavigateTo command. When I insert the folling code:
Private Sub Label_Click()
About.Hyperlink.NavigateTo "http://www.websiteaddress.com"
End Sub

it returns error: 'Method or data member not found'
I am not using ActiveX controls/documents - do I need to?
 

·
Registered
Joined
·
3,015 Posts
The NavigateTo method is a member of the webbrowser control. You can't use it just anywhere. What you probably want to do is add launch an instance of the default browser and navigate to that page. That said, I have no real experience with trying that sort of thing so I'm not going to be able to provide much help. You might try http://www.pscode.com for some examples.
 

·
Registered
Joined
·
609 Posts
Use shell32 API to do something like...

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
Code:
Private Sub Label_Click()
ShellExecute 0, vbNullString, "http://forums.techguy.org/t371854.html", vbNullString, vbNullString, vbNormalFocus
End Sub
 

·
Registered
Joined
·
165 Posts
Discussion Starter · #5 ·
Gibbs said:
Use shell32 API to do something like...

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
Code:
Private Sub Label_Click()
ShellExecute 0, vbNullString, "http://forums.techguy.org/t371854.html", vbNullString, vbNullString, vbNormalFocus
End Sub
Great but putting my own web address in place of forums etc doesn't work..! Always seems to go to the wrong page!
 

·
Registered
Joined
·
609 Posts
What do you mean 'the wrong place'? Make sure you still have the quotation (" ") marks. Heres an example:

ShellExecute 0, vbNullString, "http://www.flashpoint1982.co.uk/forum/", vbNullString, vbNullString, vbNormalFocus

Works perfectly fine for me. Make sure you have:

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

In your declarations (the top of the page). As it's a private function don't put it in a module, unless you turn it into a public function of course.

Explain in more detail what it's *not* doing....
 

·
Registered
Joined
·
165 Posts
Discussion Starter · #7 ·
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 Label_Click()
ShellExecute 0, vbNullString, "http://designsystemsyork.com", vbNullString, vbNullString, vbNormalFocus
End Sub

This ^ is what I have in code for 'About.frm' and when I run the app and clikc File-About, it displays an about form on which is the label. I click on the label and it brings up web browser - and it is on this forums page! (not designsystemsyork.com)
 
1 - 8 of 8 Posts
Status
Not open for further replies.
Top