LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 396
Default Help with C. Pearsons code to VBE

Hi all, i am using Chip Pearsons code below to insert some code in a
worksheet. When i start the macro with F8 and then run through with F5
it works fine, however when i run the full code excel gives me a dialog
box and says "Sorry excel encountered a problem and has to close" and
then re-starts ??

Any help would be appreciated.

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

End Sub

Sub CreateEventProcedure()

Dim VBProj As VBIDE.VBProject
Dim VBComp As VBIDE.VBComponent
Dim CodeMod As VBIDE.CodeModule
Dim LineNum As Long, sh As String
Const DQUOTE = """" ' one " character
sh = ActiveWorkbook.ActiveSheet.CodeName
Set VBProj = ActiveWorkbook.VBProject
Set VBComp = VBProj.VBComponents(sh)
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


Best regards,

Les Stout

*** Sent via Developersdex http://www.developersdex.com ***
 
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
Help using Chip Pearsons code to count cells with color ram Excel Discussion (Misc queries) 6 March 17th 10 01:38 PM
Pearsons skimball Excel Worksheet Functions 4 April 15th 09 07:51 PM
Chip Pearsons "Rowlander" add-in won't install suzie Excel Discussion (Misc queries) 6 September 10th 07 04:47 AM
Excel code convert to Access code - Concat & eliminate duplicates italia Excel Programming 1 September 12th 06 12:14 AM
To Chip Pearsons Steved Excel Programming 1 September 14th 05 09:15 PM


All times are GMT +1. The time now is 06:08 AM.

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

About Us

"It's about Microsoft Excel"