Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Automatic startup of an excel macro

I have an Excel macro that I want to be run at a specific time each day.
I have therefore added the Excel Workbook to the Windows scheduler
which opens it at the correct time.
The only thing that is missing now is an automatic way to run the macro
once the workbook has been opened. The optimal solution, as I see it,
would be to trigger the macro from the scheduler call with some kind of
switch but I can’t find any information about such switches. I have
fond information on how to do it in Access but this doesn’t seem to
work in Excel.

“C:\Program_Files\Office\Msaccess.exe” “C:\Files\accessfile.mdb” /x
Macro_name

The switch /x should do the job and call the macro when the document
has been opened but as mentioned above I can’t get it work in excel.

Does anyone have any suggestions on other switches or other ways to
solve my problem?

Best regards



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,089
Default Automatic startup of an excel macro

Quist

look at the VBA Help for the OnTime Method. And search the Google Archives
for OnTime ... you should find lots of examples.

Regards

Trevor


"Quist" wrote in message
...
I have an Excel macro that I want to be run at a specific time each day.
I have therefore added the Excel Workbook to the Windows scheduler
which opens it at the correct time.
The only thing that is missing now is an automatic way to run the macro
once the workbook has been opened. The optimal solution, as I see it,
would be to trigger the macro from the scheduler call with some kind of
switch but I can't find any information about such switches. I have
fond information on how to do it in Access but this doesn't seem to
work in Excel.

"C:\Program_Files\Office\Msaccess.exe" "C:\Files\accessfile.mdb" /x
Macro_name

The switch /x should do the job and call the macro when the document
has been opened but as mentioned above I can't get it work in excel.

Does anyone have any suggestions on other switches or other ways to
solve my problem?

Best regards



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Automatic startup of an excel macro

Quist,

In the 'Workbook Open' event, put the macro name, like this:

Private Sub Workbook_Open()
MyMacro
End Sub

You will find this in the Excel Visual Basic Editors 'VBAProject'
window. Double click on 'ThisWorkBook' and select 'WorkBook' from the
drop down list.



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Automatic startup of an excel macro

Thanx for the quick replies!
The drawback with the suggested methods is that I can't open the
document without running the macro.
In a perfect world I would like the scheduler to uppdate the data in my
document once a day and then I (and others) would be able to open it
for wieving data without updating it.



------------------------------------------------
~~ Message posted from http://www.ExcelTip.com/
~~ View and post usenet messages directly from http://www.ExcelForum.com/

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
Automatic Startup for a Macro gspirrison Excel Discussion (Misc queries) 5 January 5th 10 06:07 PM
Startup Macro Max Excel Discussion (Misc queries) 6 May 24th 07 01:20 PM
starting a macro at startup chip_pyp Excel Discussion (Misc queries) 1 March 22nd 06 06:59 PM
Startup macro Zeno Excel Discussion (Misc queries) 1 June 29th 05 01:06 PM
Run a Macro on Startup for Specific Spreadsheet Rod Excel Worksheet Functions 4 March 16th 05 08:52 PM


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

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"