PC Review


Reply
Thread Tools Rate Thread

Accessing VBProject causes the program to crash

 
 
=?Utf-8?B?S2xhdXM=?=
Guest
Posts: n/a
 
      14th Apr 2007
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("ThisWorkbook").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 With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to Lock VBProject Programmatically without SendKeys (Note:- Idon't want to Unlock or crack the VBProject. Just want to Lock itProgrammatically) K Microsoft VB .NET 3 21st May 2010 04:55 PM
How to Lock VBProject Programmatically without SendKeys (Note:- Idon't want to Unlock or crack the VBProject. Just want to Lock itProgrammatically) K Microsoft Excel Programming 3 14th May 2010 12:51 AM
Accessing the VBProject through another program Carlos Mallen Microsoft Excel Programming 1 12th Oct 2009 09:52 PM
crash on accessing multisession DVD or CD =?Utf-8?B?X19YWFhfXw==?= Windows XP Hardware 1 22nd Feb 2005 08:10 AM
Accessing VBProject Property Peter Microsoft Excel Programming 1 27th Sep 2004 03:01 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 07:49 PM.