LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default AppActivate & Internet Explorer file download

I am using AppActivate and Sendkeys in a macro to download a file with
Internet Explorer. With the code sequence below, I am able to enter a string
and bring up a "File Download" dialog box, but I have not been able to
initiate the download with SendKeys. The code is shown below.

I first used Sendkeys without using AppActivate to shift focus to the "File
Download" window, but the keystrokes were apparently ignored after the "File
Download" window appeared, without generating an error.

After inserting the line --AppActivate "File Download" 'bring focus to
FileDownload window"-- I received an error.

My question is: How do I use AppActivate and Sendkeys to complete a file
download with Internet explorer by way of the File Download and Save As
dialog boxes? Do I need to explicitly shift focus to the File Download window
(or Save As window), and if not, what keystrokes should I be using? I would
greatly appreciate any pointers, and I hope that I have presented my problem
intelligibly.

Thanks
-----------------
Sub File_download()

'Start Asynchronous instance of IE
ProgID = Shell("C:\Program Files\Internet Explorer\IExplore.EXE", 3) '
Run IE Explorer

'Insert Delay to allow IE to load page
newHour = Hour(Now())
newMinute = Minute(Now())
newSecond = Second(Now()) + 8
waitTime = TimeSerial(newHour, newMinute, newSecond)
Application.wait (waitTime)

'Bring focus to IE
AppActivate ProgID

'Tab to text input box on webform
SendKeys "{TAB}"

'enter symbol string to text box
SendKeys "MSFT"

'Tab to Download button
SendKeys "{TAB}"

'Initiate download
SendKeys "{ENTER}", True 'File Download box appears in IE at this point

AppActivate "File Download" 'bring focus to FileDownload window" 'error
occurs here

SendKeys "%S"
'enter filename string after Save As dialog box appears
SendKeys "test.txt"
SendKeys "{ENTER}"

End Sub
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Open Excel File in Internet Explorer ken1975 Excel Discussion (Misc queries) 0 November 20th 07 09:41 PM
Excel opens Hyperlink file in Internet Explorer jase Excel Worksheet Functions 0 March 8th 07 01:15 AM
Internet explorer download/XP Pro?? Maxwell-5000 Excel Discussion (Misc queries) 1 January 3rd 06 10:03 PM
Launching file in excel not internet explorer virtualstorm Excel Programming 0 August 9th 04 11:55 AM
Download (copy) file from the internet Jos Vens Excel Programming 1 February 3rd 04 02:14 PM


All times are GMT +1. The time now is 12:06 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"