Hello,
I am using the following construct:
ActiveWorkbook.VBProject.VBComponents("ThisWorkbook").CodeModule.InsertLines 1, code
where code is VBA code. This works fine when using a sheet such as "Sheet1" but when using "ThisWorkbook", Excel dies with the message Excel.exe has generated errors and will be closed by windows.
I need to put the code in "ThisWorkbook" because it is a Workbook_Open procedure.
Anyone have any advice?
Thanks,
Vlip
I am using the following construct:
ActiveWorkbook.VBProject.VBComponents("ThisWorkbook").CodeModule.InsertLines 1, code
where code is VBA code. This works fine when using a sheet such as "Sheet1" but when using "ThisWorkbook", Excel dies with the message Excel.exe has generated errors and will be closed by windows.
I need to put the code in "ThisWorkbook" because it is a Workbook_Open procedure.
Anyone have any advice?
Thanks,
Vlip