Chris Miller
asked on
Shell "cmd.Exe", vbNormalFocus
I would I have this open to an IP address?
Private Sub Command4_Click()
Shell "c:\program files\internet explorer\iexplore.exe", vbNormalFocus
End Sub
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Sorry for the double double posting posting...
Yes, but then you are counting on the end user having Explorer and/or wanting to use Explorer. If you use ShellExecute it will open it with the user's default browser, whether it be IE, or Opera, or Netscape. Just a thought to keep in mind. :)
Agreed. Also not a great idea hard coding the location... My first thought was that shellexecute would fail when passed an IP address. However, I found you can get around it by adding the http:// prefix:
Note to CMILLER, this is supporting the solution proposed by codeconqueror.
Option Explicit
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)
Private Sub Command1_Click()
ShowIP "127.0.0.1"
End Sub
Private Sub ShowIP(ByVal strAddress As String)
If LCase(Left$(strAddress, 7)) <> "http://" Then
strAddress = "http://" & strAddress
End If
ShellExecute Me.hWnd, "open", strAddress, vbNullString, vbNullString, vbNormalFocus
End Sub
Note to CMILLER, this is supporting the solution proposed by codeconqueror.
Option Explicit
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)
Private Sub Command1_Click()
ShowIP "127.0.0.1"
End Sub
Private Sub ShowIP(ByVal strAddress As String)
If LCase(Left$(strAddress, 7)) <> "http://" Then
strAddress = "http://" & strAddress
End If
ShellExecute Me.hWnd, "open", strAddress, vbNullString, vbNullString, vbNormalFocus
End Sub
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
To ALL,
I was looking to hard code, I am building a form to manage my network switches.
I would like to give all of you some points, they are all good solutions.
Thanks
I was looking to hard code, I am building a form to manage my network switches.
I would like to give all of you some points, they are all good solutions.
Thanks
Shell """c:\program files\internet explorer\iexplore.exe"" 127.0.0.1", vbNormalFocus