|
-
Apr 4th, 2004, 09:32 AM
#1
Thread Starter
Addicted Member
how to open a website when we click command button?
Please tell me how to open a website ,e.g :www.vbforums.com when we click the command button on the program?
Thank you very much!!!
-
Apr 4th, 2004, 12:50 PM
#2
Again, this should be in the other parts of the Forums (General VB Questions).
Also, try to include all of your questions in ONE POST.
VB Code:
Shell "iexplore [url]http://www.vbforums.com[/url]", vbMaximized
Phreak
Visual Studio 6, Visual Studio.NET 2005, MASM
-
Apr 4th, 2004, 03:47 PM
#3
PowerPoster
This code will ensure the website is openend in a new browser window. Only works for IE though...
VB Code:
On Error Resume Next
Dim Temp As Object
'Create instance
Set Temp = CreateObject("InternetExplorer.Application")
'Open URL
Temp.Navigate2 "http://fox.acky.net"
Temp.Visible = True
(If the code fails you could try Netscape and the others...)
-
Apr 5th, 2004, 02:59 PM
#4
Junior Member
This sub opens a link in the default browser. I hope it helps!
VB Code:
Private Sub openUrl(sLink As String)
Dim lPath As Long
Dim sPath As String
Dim sTempPath As String
Dim iFile As Integer
If Me.Tag = "" Then
If Dir(App.Path & "\Temp.htm") = vbNullString Then
iFile = FreeFile
Open App.Path & "\Temp.htm" For Output As iFile
Close iFile
Me.Tag = Left(sPath, FindExecutable(App.Path & "\Temp.htm", "", ByVal sPath))
Kill sTempPath & "Temp.htm"
Else
Me.Tag = Left(sPath, FindExecutable(App.Path & "\Temp.htm", "", ByVal sPath))
End If
End If
If Len(Me.Tag) Then
ShellExecute 0, "OPEN", Me.Tag, sLink, "", 1
End If
End Sub
-
Apr 5th, 2004, 05:05 PM
#5
The declarations for henrikf's code :
VB Code:
Declare Function FindExecutable Lib "shell32.dll" Alias "FindExecutableA" (ByVal lpFile As String, ByVal lpDirectory As String, ByVal lpResult As String) As Long
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
Has someone helped you? Then you can Rate their helpful post. 
-
Apr 5th, 2004, 05:13 PM
#6
Junior Member
Sorry, I missed those.
-
Apr 5th, 2004, 05:27 PM
#7
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
|