#1   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Decreenisi
 
Posts: n/a
Default timed macro

My customer has a WS, with a pivot table. In the WS he has a button
with a macro which sorts the pivot data into suppliers, and make a view
screen specific to each supplier. The problem is he has to remember to
push the button !!! Does anyone know if it is posible to run this
macro automatically, so that it exicutes every morning @ 8:00 am. Can
you add code to the macro, or does it have to be something completely
different.
Thanks

  #2   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Richard Buttrey
 
Posts: n/a
Default timed macro

On 3 Mar 2006 03:16:53 -0800, "Decreenisi"
wrote:

My customer has a WS, with a pivot table. In the WS he has a button
with a macro which sorts the pivot data into suppliers, and make a view
screen specific to each supplier. The problem is he has to remember to
push the button !!! Does anyone know if it is posible to run this
macro automatically, so that it exicutes every morning @ 8:00 am. Can
you add code to the macro, or does it have to be something completely
different.
Thanks


Is the time of 8.00 am important? By that I mean is the workbook
reliant on data that is only refreshed every day by 8.00 am at the
latest, and hence you can't push the button until post 8.00 am

If it's not important and it just needs to be run, you could attach
the macro to the workbook open event.

You can pause a macro running with the Application.Wait command, but
that pauses all other Excel Activity as well, in which case you could
use something like the following in the workbook open event

Private Sub Workbook_Open()
Dim PauseUntil as Double

PauseUntil = TimeSerial(8,0, 0)
Do While Time() < PauseUntil
Loop

.....your Pivot Table Code here

End Sub

Alternatively you could simply put

MsgBox "Push the bloody button!"

in the Workbook open event.

Probably not exactly what you're looking for, so I'll be interested to
see what others come up with.

HTH

Richard Buttrey
__
  #3   Report Post  
Posted to microsoft.public.excel.worksheet.functions
FSt1
 
Posts: n/a
Default timed macro

hi,
yes there is.
the Application.OnTime method. But the file has to be open for it to fire on
time. here is code i use. if it is friday, the code skips the weekend. if it
is not friday, the code fires a 5am the next day. if he does not have the
file open before 8am then the code will not fire untill the next 8 oclock.
look up Application.OnTime in VB help for more info. "yourMacro" is the name
of the macro you want to run at the specified time.

Sub macALaunchMR()

If Weekday(Now()) = 6 Then '1 = Sunday, 2 = Monday, 3 = Tuesday, ect

Application.OnTime Now() + 2.5 + TimeValue("00:00:03"), "yourMacro"
Else
Application.OnTime TimeValue("05:00:00"), "yourMacro"
End If

End Sub
suggestion. if he is that forgetfull then why not put the code in a file
open event so that the code runs when he opens the file?

regards
FSt1

"Decreenisi" wrote:

My customer has a WS, with a pivot table. In the WS he has a button
with a macro which sorts the pivot data into suppliers, and make a view
screen specific to each supplier. The problem is he has to remember to
push the button !!! Does anyone know if it is posible to run this
macro automatically, so that it exicutes every morning @ 8:00 am. Can
you add code to the macro, or does it have to be something completely
different.
Thanks


  #4   Report Post  
Posted to microsoft.public.excel.worksheet.functions
Bob Phillips
 
Posts: n/a
Default timed macro


"FSt1" wrote in message
...
hi,
yes there is.
the Application.OnTime method. But the file has to be open for it to fire

on
time.


No it doesn't, it will open if closed and fire.


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
Search, Copy, Paste Macro in Excel [email protected] Excel Worksheet Functions 0 January 3rd 06 06:51 PM
Closing File Error jcliquidtension Excel Discussion (Misc queries) 4 October 20th 05 12:22 PM
macro with F9 Kenny Excel Discussion (Misc queries) 1 August 3rd 05 02:41 PM
Make Alignment options under format cells available as shortcut dforrest Excel Discussion (Misc queries) 1 July 14th 05 10:58 PM
Playing a macro from another workbook Jim Excel Discussion (Misc queries) 1 February 23rd 05 10:12 PM


All times are GMT +1. The time now is 12:04 AM.

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"