Home |
Search |
Today's Posts |
|
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi
I have a template .xlt with code in (or a macro called from) the workbook open event to format various cells. The template is then saved as a .xls How can I removed the workbook open event code when the .xlt is saved as .xls Thanks Libby |
#2
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Hi Libby,
Add this code to the template. Private Sub Workbook_BeforeClose(Cancel As Boolean) Dim vbMod As Object Set vbMod = ThisWorkbook.VBProject.VBComponents("THisWorkbook" ) With vbMod.CodeModule .DeleteLines 1, .CountOfLines End With 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 But I have to ask. why not format the cells in the template, and do away with the event code? -- HTH RP (remove nothere from the email address if mailing direct) "Libby" wrote in message ... Hi I have a template .xlt with code in (or a macro called from) the workbook open event to format various cells. The template is then saved as a .xls How can I removed the workbook open event code when the .xlt is saved as ..xls Thanks Libby |
#3
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
Why not format the cells before saving the template file? That way
there is no need for any code! -- Regards, Tushar Mehta www.tushar-mehta.com Excel, PowerPoint, and VBA add-ins, tutorials Custom MS Office productivity solutions In article , says... Hi I have a template .xlt with code in (or a macro called from) the workbook open event to format various cells. The template is then saved as a .xls How can I removed the workbook open event code when the .xlt is saved as .xls Thanks Libby |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Macro recorded... tabs & file names changed, macro hangs | Excel Worksheet Functions | |||
Macro Help Needed - Excel 2007 - Print Macro with Auto Sort | Excel Worksheet Functions | |||
how to count/sum by function/macro to get the number of record to do copy/paste in macro | Excel Programming | |||
macro to delete entire rows when column A is blank ...a quick macro | Excel Programming | |||
Start Macro / Stop Macro / Restart Macro | Excel Programming |