Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #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
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 575
Default AppActivate & Internet Explorer file download

I've never used SendKeys, but why not try the API call URLDownloadToFile.

Robin Hammond
www.enhanceddatasystems.com


"mehlin" wrote in message
...
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



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default AppActivate & Internet Explorer file download

Robin,

Thanks for the response. The difficulty I have with URLDownloadToFile is
that I am trying to posting information and get a file returned in response.
The file is not associated with a specific URL, but is generated by the
server as a result of form input by the user.

"Robin Hammond" wrote:

I've never used SendKeys, but why not try the API call URLDownloadToFile.

Robin Hammond
www.enhanceddatasystems.com


"mehlin" wrote in message
...
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




  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default AppActivate & Internet Explorer file download

A common usage similar to what you describe is to pull down stock data. If
you are doing that, it can often be done with a web query.

In any event, perhaps if you post your URL (given it isn't password
protected) and a description of what you are trying to do, perhaps you can
get better help.

--
regards,
Tom Ogilvy

"mehlin" wrote in message
...
Robin,

Thanks for the response. The difficulty I have with URLDownloadToFile is
that I am trying to posting information and get a file returned in

response.
The file is not associated with a specific URL, but is generated by the
server as a result of form input by the user.

"Robin Hammond" wrote:

I've never used SendKeys, but why not try the API call

URLDownloadToFile.

Robin Hammond
www.enhanceddatasystems.com


"mehlin" wrote in message
...
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






  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3
Default AppActivate & Internet Explorer file download

Hi Tom,

Thanks for responding. I had posted the following on 9/28, but received no
responses:
-----I have been using a web query to post data to a cgi
script, but the website has switched to an ASP form. Can
anyone shed some light on how text data should be posted
to an active server page using an Excel web query?
Specifically, I am posting a stock symbol
to "http://www.cboe.com/DelayedQuote/QuoteTableDownload.asp
x" in order to download a file "QuoteData.dat"-----

In reading past posts to the group, I noticed that at least one other person
has experienced the same problem as I have with the CBOE website. At this
point I have been able to use SHELL, AppActivate, and SENDKEYS to download
files in a macro, but I have to insert delays and the overall approach is far
from elegant, with error handling and branching being difficult. I would
still like to find a better approach, but I do not know how to handle
submission to ASP.NET. Any suggestions you have would be appreciated. The
CBOE site does not have a password and the URL is:
http://www.cboe.com/DelayedQuote/Quo...eDownload.aspx

Thanks

Mehlin


"Tom Ogilvy" wrote:

A common usage similar to what you describe is to pull down stock data. If
you are doing that, it can often be done with a web query.

In any event, perhaps if you post your URL (given it isn't password
protected) and a description of what you are trying to do, perhaps you can
get better help.

--
regards,
Tom Ogilvy

"mehlin" wrote in message
...
Robin,

Thanks for the response. The difficulty I have with URLDownloadToFile is
that I am trying to posting information and get a file returned in

response.
The file is not associated with a specific URL, but is generated by the
server as a result of form input by the user.

"Robin Hammond" wrote:

I've never used SendKeys, but why not try the API call

URLDownloadToFile.

Robin Hammond
www.enhanceddatasystems.com


"mehlin" wrote in message
...
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








  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default AppActivate & Internet Explorer file download

I didn't see any workaround that would do it directly.

Maybe someone else has some thoughts.

--
Regards,
Tom Ogilvy


"mehlin" wrote in message
...
Hi Tom,

Thanks for responding. I had posted the following on 9/28, but received no
responses:
-----I have been using a web query to post data to a cgi
script, but the website has switched to an ASP form. Can
anyone shed some light on how text data should be posted
to an active server page using an Excel web query?
Specifically, I am posting a stock symbol
to "http://www.cboe.com/DelayedQuote/QuoteTableDownload.asp
x" in order to download a file "QuoteData.dat"-----

In reading past posts to the group, I noticed that at least one other

person
has experienced the same problem as I have with the CBOE website. At this
point I have been able to use SHELL, AppActivate, and SENDKEYS to download
files in a macro, but I have to insert delays and the overall approach is

far
from elegant, with error handling and branching being difficult. I would
still like to find a better approach, but I do not know how to handle
submission to ASP.NET. Any suggestions you have would be appreciated. The
CBOE site does not have a password and the URL is:
http://www.cboe.com/DelayedQuote/Quo...eDownload.aspx

Thanks

Mehlin


"Tom Ogilvy" wrote:

A common usage similar to what you describe is to pull down stock data.

If
you are doing that, it can often be done with a web query.

In any event, perhaps if you post your URL (given it isn't password
protected) and a description of what you are trying to do, perhaps you

can
get better help.

--
regards,
Tom Ogilvy

"mehlin" wrote in message
...
Robin,

Thanks for the response. The difficulty I have with URLDownloadToFile

is
that I am trying to posting information and get a file returned in

response.
The file is not associated with a specific URL, but is generated by

the
server as a result of form input by the user.

"Robin Hammond" wrote:

I've never used SendKeys, but why not try the API call

URLDownloadToFile.

Robin Hammond
www.enhanceddatasystems.com


"mehlin" wrote in message
...
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








Reply
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:39 PM.

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"