Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Unattended Macro

If you go to the vbe and right click on the ThisWorkbook entry in the
project explorer (under your workbook name), and select view code, you will
get the module where workbook level events can be placed. If you click in
the left dropdown as the top of the module, and select workbook, then in the
right dropdown at the top of the module, you select open, it will enter the
declaration for the workbook_Open event which will run whenever the workbook
is opened and macros are not disabled.

Private Sub Workbook_Open()

End Sub

If you put your code within this procedure or call your code from this
procedure, it will run when the workbook is opened either manually or
through code.

You can use the Schedular app under system tools to provide the command to
open this file using excel at appropriate times.

Your macro can do something like:

Worksheets(Array("Sheets1","Sheets5","Sheets7")).C opy
ActiveWorkbook.SaveAs "C:\myFolder\MyFile" & format("yyyymmdd") & ".xls"

to save a portion of your workbook to a unique filename - as an example.


--
Regards,
Tom Ogilvy


"buckle" wrote in message news:3f40eef4@nubby2....
Is the following possible?

Run a scheduled task to open an Excel spreadsheet and run a macro
automatically, then close the spreadsheet and return to the desktop. Seems
simple enough but I can't see where to make the macro auto start when the
spreadsheet opens. Also is it possible to save part of the spreadsheet to

a
unique file name (in the macro)?

Thanks




  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default Unattended Macro

Thanks Tom. It's so easy when someone else does all the hard work!

Cheers


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
Macro recorded... tabs & file names changed, macro hangs Steve Excel Worksheet Functions 3 October 30th 09 11:41 AM
need help to update macro to office 2007 macro enabled workbook jatman Excel Discussion (Misc queries) 1 December 14th 07 01:57 PM
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort Gavin Excel Worksheet Functions 0 May 17th 07 01:20 PM
My excel macro recorder no longer shows up when recording macro jack Excel Discussion (Misc queries) 3 February 5th 07 08:22 PM
using a cell value to control a counter inside a macro and displaying macro value ocset Excel Worksheet Functions 1 September 10th 06 05:32 AM


All times are GMT +1. The time now is 05:56 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"