Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
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 |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Open Excel File in Internet Explorer | Excel Discussion (Misc queries) | |||
Excel opens Hyperlink file in Internet Explorer | Excel Worksheet Functions | |||
Internet explorer download/XP Pro?? | Excel Discussion (Misc queries) | |||
Launching file in excel not internet explorer | Excel Programming | |||
Download (copy) file from the internet | Excel Programming |