View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
steve steve is offline
external usenet poster
 
Posts: 576
Default Automatically runing a macro

Tom,

Thanks! I like it!!! And I have just the place to use it...
I had been using a check on the workbook name, but this is more appropriate.
Should even work for workbooks that are sent via email.

--
sb
"Tom Ogilvy" wrote in message
...
Private sub Workbook_Open()
if thisworkbook.Path = "" then
mymacro
End if
End Sub


since the workbook won't have a path when it is created from the template,
this will only run during that one opening.


--
Regards,
Tom Ogilvy

Peter Longstaff wrote in message
. ..
Hi All,

I am new to VBA so please forgive this rather simple question.

I have written a macro which calls a user form and I can fill in all of

the
data and populate the worksheet as I requrie.

My problem is as follows. I have saved the worksheet as a template. I

want
the macro to run the first time a new document is created based on the
template. How do I do that ?

TIA
Peter