View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Bernie Deitrick Bernie Deitrick is offline
external usenet poster
 
Posts: 5,441
Default Auto refresh data once a day?

Just a clarification: the workbook with the macro does not need to be open, nor does the workbook
with the pivot table, but Excel would need to be running.

HTH,
Bernie
MS Excel MVP


"egun" wrote in message
...
This assumes that the workbook is open 24 hours a day, right? If not, then
this code won't run, as you acknowledged.

A possible solution to that is to schedule a task that opens the workbook at
a certain time each day (say 06:00) and have the Workbook_Open macro do the
pivot table refresh. To schedule the task, use the Scheduled Tasks uitility
under "start/All Program/Accessories/System Tools" (in XP, at least), and set
up a task that opens Excel and your workbook.

The command would be something like:

excel.exe "c:\My Folder\book1.xlsx"

You can have this happen whether or not you are logged in, as long as the
machine is turned on. You will probably have to supply your password to make
it work. One thing I'm not sure of - unless you set the security level low
enough, Excel always asks if you want to enable macros. That might get in
the way of automatically opening the file.

There are command line switches you can use to open Excel:

http://office.microsoft.com/en-us/ex...580301033.aspx

HTH,

Eric