Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Executing Macro when Workbook is Open
How do I automaticaly execute a Macro when a Workbook is Open?
-- Message posted via http://www.officekb.com |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Executing Macro when Workbook is Open
Use an Event Macro:
http://www.cpearson.com/excel/events.htm -- Gary''s Student gsnu200709 "Fredriksson via OfficeKB.com" wrote: How do I automaticaly execute a Macro when a Workbook is Open? -- Message posted via http://www.officekb.com |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Executing Macro when Workbook is Open
Private Sub Workbook_Open()
'your code End Sub 'This is workbook event code. 'To input this code, right click on the Excel icon on the worksheet '(or next to the File menu if you maximise your workbooks), 'select View Code from the menu, and paste the code -- --- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Fredriksson via OfficeKB.com" <u27002@uwe wrote in message news:6ed59182df8ff@uwe... How do I automaticaly execute a Macro when a Workbook is Open? -- Message posted via http://www.officekb.com |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Executing Macro when Workbook is Open
I placed this code in my module1 at the end. It does not execute when My
workbook is opened. Is there something I am missing? Private Sub Workbook_Open() Sheets("AP4301").Select ActiveWorkbook.Names.Add Name:="Company", RefersToR1C1:="=AP4301!R1C2" ActiveWorkbook.Names.Add Name:="AcctgPeriod", RefersToR1C1:="=AP4301! R2C2" ActiveWorkbook.Names.Add Name:="Vendor", RefersToR1C1:="=AP4301!R5C2" ActiveWorkbook.Names.Add Name:="OccurDate", RefersToR1C1:="=AP4301!R11C2" ActiveWorkbook.Names.Add Name:="Approver", RefersToR1C1:="=AP4301!R19C2" ActiveWorkbook.Names.Add Name:="RowsToClear", RefersToR1C1:= _ "=AP4301!R23:R65536" Sheets("Xref Property").Select ActiveWorkbook.Names.Add Name:="PropertyKey", RefersToR1C1:= _ "='Xref Property'!R2C1" Sheets("Xref COA").Select ActiveWorkbook.Names.Add Name:="COAkey", RefersToR1C1:="='Xref COA'!R2C2" MenuForm.Show End Sub Bob Phillips wrote: Private Sub Workbook_Open() 'your code End Sub 'This is workbook event code. 'To input this code, right click on the Excel icon on the worksheet '(or next to the File menu if you maximise your workbooks), 'select View Code from the menu, and paste the code How do I automaticaly execute a Macro when a Workbook is Open? -- Message posted via http://www.officekb.com |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Executing Macro when Workbook is Open
Did you put it in ThisWorkbook as I described.
-- --- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Fredriksson via OfficeKB.com" <u27002@uwe wrote in message news:6ee223bf61d00@uwe... I placed this code in my module1 at the end. It does not execute when My workbook is opened. Is there something I am missing? Private Sub Workbook_Open() Sheets("AP4301").Select ActiveWorkbook.Names.Add Name:="Company", RefersToR1C1:="=AP4301!R1C2" ActiveWorkbook.Names.Add Name:="AcctgPeriod", RefersToR1C1:="=AP4301! R2C2" ActiveWorkbook.Names.Add Name:="Vendor", RefersToR1C1:="=AP4301!R5C2" ActiveWorkbook.Names.Add Name:="OccurDate", RefersToR1C1:="=AP4301!R11C2" ActiveWorkbook.Names.Add Name:="Approver", RefersToR1C1:="=AP4301!R19C2" ActiveWorkbook.Names.Add Name:="RowsToClear", RefersToR1C1:= _ "=AP4301!R23:R65536" Sheets("Xref Property").Select ActiveWorkbook.Names.Add Name:="PropertyKey", RefersToR1C1:= _ "='Xref Property'!R2C1" Sheets("Xref COA").Select ActiveWorkbook.Names.Add Name:="COAkey", RefersToR1C1:="='Xref COA'!R2C2" MenuForm.Show End Sub Bob Phillips wrote: Private Sub Workbook_Open() 'your code End Sub 'This is workbook event code. 'To input this code, right click on the Excel icon on the worksheet '(or next to the File menu if you maximise your workbooks), 'select View Code from the menu, and paste the code How do I automaticaly execute a Macro when a Workbook is Open? -- Message posted via http://www.officekb.com |
#6
Posted to microsoft.public.excel.programming
|
|||
|
|||
Executing Macro when Workbook is Open
I did not understood what you meant by This Workbook but I do now. Thanks for
all of your help. It is working Bob Phillips wrote: Did you put it in ThisWorkbook as I described. I placed this code in my module1 at the end. It does not execute when My workbook is opened. [quoted text clipped - 31 lines] How do I automaticaly execute a Macro when a Workbook is Open? -- Message posted via http://www.officekb.com |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Open workbook macro- find correct month to open? | Excel Programming | |||
Executing a macro in a closed workbook | Excel Programming | |||
Problem executing a macro from different workbook where it is | Excel Discussion (Misc queries) | |||
File Already Open Error When Executing A Macro | Excel Programming | |||
File Already Open Error When Executing A Macro | Excel Programming |