D
Dan McCollick
Hello all.
I am currently developing some code to open an excel file from a
password protected intranet website. When i step through my code,
everything works fine, but when run normally my code will die at the if
application.workbooks.count=currentnumexcel statement(i.e. the code
executes faster then excel can open the file from ie?!).
I thought by having the While ie.busy loop, i would avoid this problem;
do i need to add something like while Excel is opening the file,
wait?? What's the correct syntax for this?
Thanks
<Code>
currentnumexcel = Application.Workbooks.Count
frm.Click
While IE.Busy
DoEvents
Wend
' if opened new excel instance then copy otherwise prompt error
If Application.Workbooks.Count = currentnumexcel Then
Application.Workbooks(currentnumexcel).Activate
MsgBox URL & " could not be opened, please check your login
information", vbExclamation
Exit Function
Else
Set xlEroom = Application.Workbooks(Application.Workbooks.Count)
End If
'get application data
</code>
I am currently developing some code to open an excel file from a
password protected intranet website. When i step through my code,
everything works fine, but when run normally my code will die at the if
application.workbooks.count=currentnumexcel statement(i.e. the code
executes faster then excel can open the file from ie?!).
I thought by having the While ie.busy loop, i would avoid this problem;
do i need to add something like while Excel is opening the file,
wait?? What's the correct syntax for this?
Thanks
<Code>
currentnumexcel = Application.Workbooks.Count
frm.Click
While IE.Busy
DoEvents
Wend
' if opened new excel instance then copy otherwise prompt error
If Application.Workbooks.Count = currentnumexcel Then
Application.Workbooks(currentnumexcel).Activate
MsgBox URL & " could not be opened, please check your login
information", vbExclamation
Exit Function
Else
Set xlEroom = Application.Workbooks(Application.Workbooks.Count)
End If
'get application data
</code>