Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Importing External data 1

Status
Not open for further replies.

ADE6

Programmer
Apr 4, 2004
93
GB
Hi

I am importing Financial Market data into Excel,this seems to work ok,i would like the updates to take place at a specific time of day.

I have looked at the External Data Range Properties box(refresh control)this allows three options,none of which are what i really need.

I would like to refresh the data at 22:05 B.S.T,is it possible to write code to control this process.


Thanks for the ideas

Ade
 
Ade,

You can use a small amount ot VBA code to accomplish this. In a Module paste...
Code:
Sub ActivateTimer()
 Application.OnTime TimeValue("22:05:00"), "RefreshQuery"
Sub RefreshQuery()
  Worksheets("YourSheet").QueryTables(1).Refresh
End Sub
Then in the ThisWorkbook Object
Code:
Private Sub Workbook_Open()
  ActivateTimer
End Sub
So when you open the workbook, ActivateTimer turns the timer on to run RefreshQuery at the desired time.

Just name the Worksheet properly in that routine.


Skip,
[sub]
[red]Be advised:[/red] [glasses]
Alcohol and Calculus do not mix!
If you drink, don't derive! [tongue][/sub]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top