Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Accessing VBProject causes the program to crash
I have a module that writes code to a worksheet..
I have checked "Trust access to Visual Basic Project. Excel crashes. Any ideas. ---------------------------------------------------------------------------------------------- Sub MoveCode() 'It produces event actions delete Save As and restore Save As code in "ThisWorkbook" module 'It copies from file module_code, into Module1 the code for the help file and delete Save As and restore Save As FName = FilePath & "module_code.txt" Set CurrentWorkbook = Workbooks(NewTimesheet) CurrentWorkbook.VBProject.VBComponents.Import FName Set VBCodeMod = Workbooks(NewTimesheet).VBProject.VBComponents("Th isWorkbook").CodeModule With VBCodeMod LineNum = .CountOfLines + 1 .InsertLines LineNum, "Private Sub Workbook_Activate()" & Chr(13) & " Delete_SaveAs" & Chr(13) & "End Sub" .InsertLines LineNum, "Private Sub Workbook_Deactivate()" & Chr(13) & " Restore_SaveAs" & Chr(13) & "End Sub" End With End Sub -------------------------------------------------------------------------------------------- |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
accessing another program from Excel | Excel Programming | |||
Charts causing program to crash | Charts and Charting in Excel | |||
Accessing VBProject Property | Excel Programming | |||
Documentation for VBProject | Excel Programming | |||
VBProject events? | Excel Programming |