O
Oreg
Hello,
My current macro is unreliable for some reason. Depending on the value
of certain cells in Sheets("SONET"), I would like to open a new browser
for the web address in each cell in a specific range. The following
code is working, but not always....not sure why. I am
trying to slow down the macro to allow the user the ability to enter
their user name and password into a pop up box before the next browser
is opened. Is there a way to recognize not to open other browers until
after the user name and password are entered ?
Thank you
Private Sub CommandButton2_Click()
Dim ws3 As Worksheet
Set ws3 = Worksheets("SONET")
Dim sPath As String
Dim sURL As String
Dim tURL As String
Dim uURL As String
Dim vURL As String
Dim wURL As String
Dim xURL As String
Dim dTaskID As Double
Dim eTaskID As Double
Dim fTaskID As Double
Dim gTaskID As Double
Dim hTaskID As Double
Dim iTaskID As Double
sPath = "C:\Program Files\Netscape\Communicator\Program\netscape.exe"
'my browser
With Application
Sleep 7000
If ws3.Range("B2").Value = "0" Then
MsgBox "No systems to check"
End If
If ws3.Range("B2").Value > "0" Then
sURL = Sheets("SONET").Range("J2").Value
dTaskID = Shell(sPath & " " & sURL, vbNormalFocus)
Sleep 500
End If
If ws3.Range("B3").Value > "0" Then
tURL = Sheets("SONET").Range("J3").Value
eTaskID = Shell(sPath & " " & tURL, vbNormalFocus)
Sleep 500
End If
If ws3.Range("B4").Value > "0" Then
uURL = Sheets("SONET").Range("J4").Value
fTaskID = Shell(sPath & " " & uURL, vbNormalFocus)
Sleep 500
End If
If ws3.Range("B5").Value > "0" Then
vURL = Sheets("SONET").Range("J5").Value
gTaskID = Shell(sPath & " " & vURL, vbNormalFocus)
Sleep 500
End If
If ws3.Range("B6").Value > "0" Then
wURL = Sheets("SONET").Range("J6").Value
hTaskID = Shell(sPath & " " & wURL, vbNormalFocus)
Sleep 500
End If
If ws3.Range("B7").Value > "0" Then
xURL = Sheets("SONET").Range("J7").Value
iTaskID = Shell(sPath & " " & xURL, vbNormalFocus)
End If
End With
End Sub
Thanks
Oreg
My current macro is unreliable for some reason. Depending on the value
of certain cells in Sheets("SONET"), I would like to open a new browser
for the web address in each cell in a specific range. The following
code is working, but not always....not sure why. I am
trying to slow down the macro to allow the user the ability to enter
their user name and password into a pop up box before the next browser
is opened. Is there a way to recognize not to open other browers until
after the user name and password are entered ?
Thank you
Private Sub CommandButton2_Click()
Dim ws3 As Worksheet
Set ws3 = Worksheets("SONET")
Dim sPath As String
Dim sURL As String
Dim tURL As String
Dim uURL As String
Dim vURL As String
Dim wURL As String
Dim xURL As String
Dim dTaskID As Double
Dim eTaskID As Double
Dim fTaskID As Double
Dim gTaskID As Double
Dim hTaskID As Double
Dim iTaskID As Double
sPath = "C:\Program Files\Netscape\Communicator\Program\netscape.exe"
'my browser
With Application
Sleep 7000
If ws3.Range("B2").Value = "0" Then
MsgBox "No systems to check"
End If
If ws3.Range("B2").Value > "0" Then
sURL = Sheets("SONET").Range("J2").Value
dTaskID = Shell(sPath & " " & sURL, vbNormalFocus)
Sleep 500
End If
If ws3.Range("B3").Value > "0" Then
tURL = Sheets("SONET").Range("J3").Value
eTaskID = Shell(sPath & " " & tURL, vbNormalFocus)
Sleep 500
End If
If ws3.Range("B4").Value > "0" Then
uURL = Sheets("SONET").Range("J4").Value
fTaskID = Shell(sPath & " " & uURL, vbNormalFocus)
Sleep 500
End If
If ws3.Range("B5").Value > "0" Then
vURL = Sheets("SONET").Range("J5").Value
gTaskID = Shell(sPath & " " & vURL, vbNormalFocus)
Sleep 500
End If
If ws3.Range("B6").Value > "0" Then
wURL = Sheets("SONET").Range("J6").Value
hTaskID = Shell(sPath & " " & wURL, vbNormalFocus)
Sleep 500
End If
If ws3.Range("B7").Value > "0" Then
xURL = Sheets("SONET").Range("J7").Value
iTaskID = Shell(sPath & " " & xURL, vbNormalFocus)
End If
End With
End Sub
Thanks
Oreg