ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   execute code after web query (https://www.excelbanter.com/excel-programming/413886-execute-code-after-web-query.html)

christian_spaceman

execute code after web query
 
Hi there,

I have some web querys running (which download stock prices from yahoo
finance). THese are set to update every few minutes (via the
refreshperiod property).

I'd like to be able to keep historical records of everything that is
downloaded with each webquery. I fugre that the best way of doing this
is to copy the results of each query into a separate table.

Which brings me to my question... Is there any way to get a piece of
code to execute immediately after vba / excel has performed one of
it's web query refreshes? I imagine the other way is to have a loop
which just copies all the results every few minutes, but this seems a
bit hit and miss to me (and will pbly stop vba doing anything else
useful in the meantime).

Many thanks,

Chris


Nigel[_2_]

execute code after web query
 
Not sure if this is the solution, but why not monitor the cells where the
data is written for changes and then use this event to trigger updating a
history log?

The following is monitoring range A1:C3 for changes

Private Sub Worksheet_Change(ByVal Target As Range)
With Target
If .Row = 1 And .Row <= 3 And .Column = 1 And .Column <= 3 Then
'copy the log
MsgBox "Here"
End If
End With
End Sub
--

Regards,
Nigel




"christian_spaceman" wrote in message
...
Hi there,

I have some web querys running (which download stock prices from yahoo
finance). THese are set to update every few minutes (via the
refreshperiod property).

I'd like to be able to keep historical records of everything that is
downloaded with each webquery. I fugre that the best way of doing this
is to copy the results of each query into a separate table.

Which brings me to my question... Is there any way to get a piece of
code to execute immediately after vba / excel has performed one of
it's web query refreshes? I imagine the other way is to have a loop
which just copies all the results every few minutes, but this seems a
bit hit and miss to me (and will pbly stop vba doing anything else
useful in the meantime).

Many thanks,

Chris



christian_spaceman

execute code after web query
 
Great idea - many thanks Nigel


On Jul 11, 9:46*am, "Nigel" wrote:
Not sure if this is the solution, but why not monitor the cells where the
data is written for changes and then use this event to trigger updating a
history log?

The following is monitoring range A1:C3 for changes

Private Sub Worksheet_Change(ByVal Target As Range)
*With Target
* If .Row = 1 And .Row <= 3 And .Column = 1 And .Column <= 3 Then
* * * 'copy the log
* * * MsgBox "Here"
* End If
*End With
End Sub
--

Regards,
Nigel


"christian_spaceman" wrote in message

...



Hi there,


I have some web querys running (which download stock prices from yahoo
finance). THese are set to update every few minutes (via the
refreshperiod property).


I'd like to be able to keep historical records of everything that is
downloaded with each webquery. I fugre that the best way of doing this
is to copy the results of each query into a separate table.


Which brings me to my question... Is there any way to get a piece of
code to execute immediately after vba / excel has performed one of
it's web query refreshes? I imagine the other way is to have a loop
which just copies all the results every few minutes, but this seems a
bit hit and miss to me (and will pbly stop vba doing anything else
useful in the meantime).


Many thanks,


Chris- Hide quoted text -


- Show quoted text -




All times are GMT +1. The time now is 05:06 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com