View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
JLGWhiz JLGWhiz is offline
external usenet poster
 
Posts: 3,986
Default how to autorun a macro from personal.xls?

I suppose the simplest way would be to copy the macro from personal.xls to
the other workbook and then use the Workbook_Open method to run the macro.
If your macro is in the code module, you open the module with Alt+f11 while
you have both workbooks open. In the project window on the left of the
screen you can select the code module for Personal.xls to get the code you
want to copy and then scroll to the code module for the other workbook and
paste the code in that workbook code module. Then save the workbooks and the
macro will be available in both workbooks.

If this is confusing to you, you need to get someone in your office who
works with code to help.

"violet" wrote:

but my macro is store in personal.xsl. so what the code to call that macro.i
only know how to call macro that is store in that workbook but not on another
workbook.

"JLGWhiz" wrote:

Open your VBA editor with Alt + f11 and double click "This Workbook". Use:

Private Sub Workbook_Open()
MyMacro 'The name of your macro
End Sub

The open event will initiate your macro.



"violet" wrote:

i need the workbook to auto run the macro from personal.xls once i open the
workbok?how can i do that?