Open excel file from password protected Intranet site(IE)

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>
 
T

Tim Williams

If you want to bump a post then at least include your original question: not everyone is using web "forums"...

It would also be helpful to post all of your IE-relevant code. Without seeing how you're loading the page it's less easy to
suggest fixes.

Automation of IE typically looks something like this:

ie.Navigate sURL
Do Until ie.ReadyState = 4
DoEvents
Loop

Try that instead of IE.busy

Tim.
 
D

Dan McCollick

Thanks Tim, your solution worked.

How would i include my original question in the post? is it just a
copy and paste?



From: Dan McCollick - view profile
Date: Thurs, Apr 20 2006 4:50 pm
Email: "Dan McCollick" <[email protected]>
Groups: microsoft.public.excel.programming
Not yet ratedRating:
show options


Reply | Reply to Author | Forward | Print | Individual Message | Show
original | Remove | Report Abuse | Find messages by this author


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>


Reply





From: Dan McCollick - view profile
Date: Wed, May 3 2006 4:16 pm
Email: "Dan McCollick" <[email protected]>
Groups: microsoft.public.excel.programming
Not yet ratedRating:
show options


Reply | Reply to Author | Forward | Print | Individual Message | Show
original | Remove | Report Abuse | Find messages by this author


bump

Reply





From: Tim Williams - view profile
Date: Thurs, May 4 2006 12:30 am
Email: "Tim Williams" <timjwilliams at gmail dot com>
Groups: microsoft.public.excel.programming
Not yet ratedRating:
show options


Reply | Reply to Author | Forward | Print | Individual Message | Show
original | Report Abuse | Find messages by this author


If you want to bump a post then at least include your original
question: not everyone is using web "forums"...

It would also be helpful to post all of your IE-relevant code. Without
seeing how you're loading the page it's less easy to
suggest fixes.


Automation of IE typically looks something like this:


ie.Navigate sURL
Do Until ie.ReadyState = 4
DoEvents
Loop


Try that instead of IE.busy


Tim.
 
T

Tim Williams

If using Google groups there's an option to reply under the "show options" link in the message header. This one includes the
original text (trim as appropriate) in your reply.

If using a newreader then set the appropriate option (depends on what you're using)
 

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

Top