Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Excel VBA > Excel VBA
|
Excel VBA Discuss using VBA for Excel programming.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Excel VBA section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old April 28th, 2006, 04:35 AM
Registered User
 
Join Date: Apr 2006
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

hi...

innerhtml does not give me the scripts.. i want to copy that also...

 
Old April 28th, 2006, 04:50 AM
Authorized User
 
Join Date: Dec 2004
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi maccas

The IE automation process is going very well and getting the job done within few minutes instead of the whole day. I would like to thank you very much for your help.

Regards
Jann

 
Old May 25th, 2006, 11:46 AM
Registered User
 
Join Date: May 2006
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi maccas

I used your code but am getting a problem, using this code I want to download a file from a site which prompts for "File Download" options like Open, Save or Cancel; I am not able to use SendKeys to press any key on this prompt.

Can you suggest a solution.


 
Old May 31st, 2006, 09:35 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 173
Thanks: 0
Thanked 3 Times in 3 Posts
Default

Desperado,

It sounds to me like your program is racing ahead of the File Download dialog box - you should be able to use SendKeys, I'm sure I have in the past. This is a typical problem with SendkEys and why its use is not recomended unless there's no other option.

In this case you're going to have to make the macro pause for long enough to let the file download dialog box pop up. Try the following code to make it pause for three seconds, obviously if three seconds is not long enough feel free to amend...

Code:
    ' Use SendKeys to make sure file is downloaded with correct name
    Application.Wait (Now + TimeValue("0:00:03"))
    Application.SendKeys Keys:="+{TAB}", Wait:=True
    Application.SendKeys Keys:="{ENTER}", Wait:=True
Maccas

 
Old June 1st, 2006, 03:54 AM
Registered User
 
Join Date: May 2006
Posts: 9
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Maccas

Thanks for that, I figured that out before your post to my query, but I am into another problem now. This pause thing works sometimes and fails occasionally. Probably, this depend on network connectivity, how long this pause should be implemented.

I want to know if there is some method to navigate through explorer with a direct URL with options. I have one page with a download button and I used sendkeys to press this download button, to avoid using sendkeys I can directly naviate the page with appended options for the file to be downloaded, e.g.

...../jsppage=download.jsp?param1=abc;param2=123

and it prompts me to save, open or cancel dialog box.

Can I avoid getting this prompt dialogue box ?

Thanks!
Desperado
 
Old June 1st, 2006, 04:05 AM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 173
Thanks: 0
Thanked 3 Times in 3 Posts
Default

I'm not too sure on this one but I think the Open / Save / Cancel dialgoue box is a basic security feature of IE and therefore can't be circumvented. Could you have a look at automating the "Save target as ..." option in the context menu? In any case, you'll still have to deal with the undetermined load-length of the Save File Dialogue baox afterwards.

You could try pushing out the wait length just to be sure, or if you were feeling clever you could have a go at "watching" the number of windows that that Windows has open to try to deterimine when your Open / Save / Cancel dialgoue box has opened. The latter option will (almost certainly) require you to use some Win API functions though and can't be done in normal Excel VBA.

Let us know how you get on.

Maccas

 
Old July 19th, 2006, 11:43 AM
Registered User
 
Join Date: Jul 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi maccas

This code is really useful. Thanks a lot.

I have a problem though. I want it to click on a link that runs a javascript and it can't seem to find it.

The link is on the UK National Statistics Website http://www.nomisweb.co.uk/ under 'Advanced query' (you need to login as a guest.

I can't persuade it to click on the 'by geographic type' link.

Any help would be greatly appreciated.



 
Old July 30th, 2006, 03:47 AM
Registered User
 
Join Date: Jul 2006
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to rukmang
Default

hi you all,

seen all great code. Great... Well guys , i have problem.
1)I want to know how to send the login information to a web page using vb6.(same example which maccas has given )
2) I have assignment to do where i capture response times (download start , download ends). I have use ie automation with events download begin , download complete & it works ok. But for pages where a new window gets opened, i have to use new_window event, create a new document & again use download begin , download complete for that child ie. Is there any other way out (without using events)

 
Old June 15th, 2007, 07:53 PM
Registered User
 
Join Date: Jun 2007
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I tried the code given by Maccas but running into problem

When I run this code, it gives me an error in the line
Private Function ClickLink(LinkText As String, hDoc As MSHTML.HTMLDocument, IExp As SHDocVw.InternetExplorer) As Boolean

Error is: Compile Error: User-Defined type not defined

Using Excel 2002 (9.0.3821 SR-1)





Similar Threads
Thread Thread Starter Forum Replies Last Post
Horizontal Menubar using XSL and Java Script aaron385 XSLT 2 July 16th, 2008 03:09 AM
how to hide IE's addressbar, toolbar and menubar? MTLedari ASP.NET 2.0 Basics 6 April 12th, 2007 09:02 AM
how create menubar, menu, menu item in xsl vijayanmsc XSLT 1 June 5th, 2006 06:43 AM
window w/o menubar,toolbar ... silver_cuts Classic ASP Basics 6 June 29th, 2004 07:27 AM
ADP Menubar ginoitalo Access 2 April 11th, 2004 11:53 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.