Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
Les Les is offline
external usenet poster
 
Posts: 240
Default Programming to the VBE - Help

Hi all, i am trying to use the code below to insert some code into the
worksheet. It works fine with F8 and F5 but when i run the code excel closes
due to an error.???

Can anybody help me with this please ??

Sub BBBStdR()
'
On Error Resume Next
CreateEventProcedure
On Error Resume Next
Application.OnTime Now + TimeValue("00:00:02"), "MoveKTLToArchiveR"

End Sub

Sub CreateEventProcedure()

Dim VBProj As VBIDE.VBProject
Dim VBComp As VBIDE.VBComponent
Dim CodeMod As VBIDE.CodeModule
Dim LineNum As Long, sName As String, myKTL As String
myKTL = "90ZA0810"
sName = Workbooks("Status-Report-" & myKTL & ".xls").Sheets("ALL LC
PARTS").CodeName
Set VBProj = ActiveWorkbook.VBProject
Set VBComp = VBProj.VBComponents(sName)
Set CodeMod = VBComp.CodeModule

With CodeMod
LineNum = .CreateEventProc("BeforeDoubleClick", "Worksheet")
LineNum = LineNum + 1
.InsertLines LineNum, "Cancel = True"
.InsertLines LineNum, "Worksheets(""0908 RMT"").Activate"
.InsertLines LineNum, "Application.ActiveSheet.ShowAllData"
.InsertLines LineNum, "Cancel = True"
End With

End Sub

--
Les
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
programming [email protected] Excel Programming 0 August 24th 06 11:55 PM
Programming Javad Excel Programming 1 January 29th 05 09:16 PM
Programming IDE JS[_4_] Excel Programming 1 November 20th 03 09:11 AM
vba programming sal Excel Programming 1 October 27th 03 07:44 PM
How to add via programming ? Milind Excel Programming 3 September 10th 03 11:57 PM


All times are GMT +1. The time now is 10:15 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"