View Single Post
  #17   Report Post  
Posted to microsoft.public.excel.misc
Dave Peterson Dave Peterson is offline
external usenet poster
 
Posts: 35,218
Default Macro to run on file open

Maybe you could use the workbook_beforeclose event (in the ThisWorkbook module)
or you could use the Auto_Close procedure in a General module.

David Langschied wrote:

I have looked throught this thread for an issue that I have come across. It
doe snot resolve it, but this looks like the right area.

I have a set of macros that I want to fire off in a single workbook. This
works perfectly. However ...

I am adding a menu item that allows me to run one particular macro when an
editing process is completed. This menu item appears in all workbooks after
that. I want the macro to cleanup after the end user closes the workbook.

I have a deletemenu sub that will do this, but I am struggling on how to get
it to fire off.

This group is awesome! I have had very good responses to date!

Regards,
David Langschied
"Gord Dibben" wrote:

Chuck

Right-clicking on a sheet tab and "view code" only gives you Worksheet module.

Best to right-click on the Excel logo left of "File" on menu and "View Code".

This opens the Thisworkbook module.


Gord

On Thu, 11 Jan 2007 04:26:00 -0800, CLR wrote:

That's what Don was saying.........are you sure you put it in the
"ThisWorkbook" module?
Right-click on a Tab, ViewCode then double-click on the "ThisWorkbook"
module and paste in the right hand window.

Vaya con Dios,
Chuck, CABGx3



"Marie Bayes" wrote:

Hi

Thanks for that, I've put this into a module, when I run it, all works fine,
but when I open my spreadsheet, nothing happens, is there something else I
need to do?

"CLR" wrote:

Yup, I forgot to mention it...........thanks for the catch Don.

Vaya con Dios,
Chuck, CABGx3



"Don Guillett" wrote:

This needs to be put in the ThisWorkbook module.

--
Don Guillett
SalesAid Software

"CLR" wrote in message
...

Private Sub Workbook_Open()
Call YourMacroName
End Sub

hth
Vaya con Dios,
Chuck, CABGx3


"Marie Bayes" wrote:

Hi

Is there a way to start a macro running as soon as a file opens?

Thanks






--

Dave Peterson