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: 89
Default programming the VBE for a new event procedure

i'm trying to add code to give function to a newly created command button on
the form "frmTimeClock"
but, am not quite getting it right... (?)

the error occurs at line 7 (57017, event handler is invalid)

----------------------------------------------
1 Private Sub CommandButton1_Click()
2 Dim StartLineNum As Long
3 Dim mycmd As MSForms.CommandButton

4 Set mycmd = frmTimeClock.Controls.Add("forms.commandbutton.1")
5 mycmd.Caption = mycmd.Name

6 With ActiveWorkbook.VBProject.VBComponents("frmTimeCloc k").CodeModule
7 StartLineNum = .CreateEventProc("click", mycmd.Name) + 1
8 .InsertLines StartLineNum, _
9 "msgbox""You done it"",vbOKOnly"
10 End With

11 End Sub
------------------------------------------------


thanks (as always) in advance
mark


 
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
workbook_Open event Procedure peerless Excel Discussion (Misc queries) 1 May 22nd 06 10:21 PM
workbook_Open event Procedure peerless Excel Discussion (Misc queries) 0 May 22nd 06 10:16 PM
Event Procedure Programming Jeff Armstrong Excel Programming 1 July 29th 04 03:54 PM
OnTime event not firing in Workbook_Open event procedure GingerTommy Excel Programming 0 September 24th 03 03:18 PM
Programming a current procedure Dave Peterson[_3_] Excel Programming 1 July 19th 03 01:58 PM


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