Macro timing might be the problem

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. :confused: 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
 
L

Leith Ross

Hello Oreg,

Are you generating the password popup or is the browser?

Thanks,
Leith Ross
 
O

Oreg

Hi Leith,

The website is generating the password popup. I've tried sending the
user name and password inserted into the URL address but that doesn't
seem to work. Sendkeys is not reliable. What I've found is once the
username and password is entered, all other browsers no longer require
the password to be entered. I was attempting to allow the user time to
enter the username and password in before the next browser appears. If
the other browsers open before the password is entered, they do not
load.

Oreg
 
L

Leith Ross

Hello Oreg,

Tell me the sequence of events. Does the user select the browser first
and then it launchs and the popup is displayed or something different?

Thanks,
Leith
 
O

Oreg

Hi Leith,

My userform has a listbox which displays a list of systems (data
located in Sheets("SONET"). In column J of Sheets("SONET") is a URL
address for each system. Basically, the only difference between each
system's URL address is an ID number on the back end of the URL. When
a button is pressed on my form, the URL in cells J2 should be loaded
first. The Website is password protected, so I was trying to use Sleep
to allow time for the user to enter their usrname and password. After
the password is entered one time, all other systems( for cells (J3, J4
.....) and so on, would open in seperate browsers.

Thanks,

Oreg
 
L

Leith Ross

Hello Oreg,

Do you know of any other way to trigger a password request other tha
passing a URL to the server?

Leit
 
O

Oreg

Leith,

I don't know of another way to trigger the password request other than
passing the URL....unfortunately. :)

Oreg
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads

Listbox selection follows hyperlink 4
Quick Debug Help 3
Code condition 3
Copy code failing 2
Copy code - JLGWhiz 3
Table format - connection string problem 1
Add sheet 2
Next Cell Empty Issues 3

Top