Check my code to use template?
I have created a template to use every two or three days. It's coded on a
Workbook_Open event as ReadOnly, with the data-bearing sheets set to xlVeryHidden. If I'm going to use this as a template, I need to be able to open it from within a macro with all macros disabled and all sheets visible. At the moment, the macro that creates my spreadsheet calls up a new workbook using Set wb3 = Workbooks.Add so I need to replace that with code to call up this template. Do I have the right code to - call up from a macro? Dim wb3 As Workbook wb3 = C:\Documents and Settings\ etc. \filename.xls disable macros? Application.EnableEvents = False make sheets visible? wb3.Sheets(Sheet1).Visible = True wb3.Sheets(Sheet2).Visible = True wb3.Sheets(Sheet3).Visible = True Two further questions about the EnableEvents - (1) will it affect the macro already running, or any other macros called up in the process? do I have to constrain the command somehow to affect only the workbook I'm opening? (2) where is the best place to put the Application.EnableEvents = True? just before I SaveAs? or after? Thank you. Ed |
All times are GMT +1. The time now is 09:48 PM. |
Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com