Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 11
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
accessing another program from Excel [email protected] Excel Programming 10 April 27th 06 04:30 PM
Charts causing program to crash Fysh Charts and Charting in Excel 1 December 16th 04 10:12 PM
Accessing VBProject Property Peter[_44_] Excel Programming 1 September 27th 04 03:01 AM
Documentation for VBProject Wes Jester Excel Programming 2 September 30th 03 06:26 PM
VBProject events? Chip Pearson Excel Programming 0 September 10th 03 10:36 AM


All times are GMT +1. The time now is 06:24 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"