Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
Insert Worksheet change procedure
I get a runtime error in Excel using the following method:
Sub AddEvents() Dim vbc As VBComponent, pos As Long, body as String For Each vbc In ActiveWorkbook.VBProject.VBComponents If vbc.name = Worksheets(1).codeName Then pos = vbc.CodeModule.CreateEventProc("Change", "Worksheet") body = wsEvent vbc.CodeModule.InsertLines pos, body Exit For End If Next End Sub What am i doing wrong? Any help appreciated ojv |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
Insert Worksheet change procedure
On 4 Giu, 23:37, ojv wrote:
I get a runtime error in Excel using the following method: Sub AddEvents() Dim vbc As VBComponent, pos As Long, body as String * * For Each vbc In ActiveWorkbook.VBProject.VBComponents * * * * If vbc.name = Worksheets(1).codeName Then * * * * * * pos = vbc.CodeModule.CreateEventProc("Change", "Worksheet") * * * * * * body = wsEvent * * * * * * vbc.CodeModule.InsertLines pos, body * * * * * * Exit For * * * * End If * * Next End Sub What am i doing wrong? Any help appreciated ojv Hi ojv. Probably you forget a reference to: 'Microsoft visual basic for applications extensibility 5.x as required by Mr. "r". For further informations, see: http://www.cpearson.com/excel/vbe.aspx Regards Eliano |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
Insert Worksheet change procedure
On 4 Giu, 23:37, ojv wrote:
I get a runtime error in Excel using the following method: Sub AddEvents() Dim vbc As VBComponent, pos As Long, body as String * * For Each vbc In ActiveWorkbook.VBProject.VBComponents * * * * If vbc.name = Worksheets(1).codeName Then * * * * * * pos = vbc.CodeModule.CreateEventProc("Change", "Worksheet") * * * * * * body = wsEvent * * * * * * vbc.CodeModule.InsertLines pos, body * * * * * * Exit For * * * * End If * * Next End Sub What am i doing wrong? Any help appreciated ojv Hi ojv. Probably you forget a reference to: 'Microsoft visual basic for applications extensibility 5.x as required by Mr. "r". For further informations, see: http://www.cpearson.com/excel/vbe.aspx Regards Eliano |
#4
Posted to microsoft.public.excel.programming
|
|||
|
|||
Insert Worksheet change procedure
Any resolution to this issue? I am having the same problem. thanks "ojv" wrote: I get a runtime error in Excel using the following method: Sub AddEvents() Dim vbc As VBComponent, pos As Long, body as String For Each vbc In ActiveWorkbook.VBProject.VBComponents If vbc.name = Worksheets(1).codeName Then pos = vbc.CodeModule.CreateEventProc("Change", "Worksheet") body = wsEvent vbc.CodeModule.InsertLines pos, body Exit For End If Next End Sub What am i doing wrong? Any help appreciated ojv |
#5
Posted to microsoft.public.excel.programming
|
|||
|
|||
Insert Worksheet change procedure
On 9 Lug, 19:33, jk wrote:
Any resolution to this issue? I am having the same problem. *thanks "ojv" wrote: I get a runtime error in Excel using the following method: Sub AddEvents() Dim vbc As VBComponent, pos As Long, body as String * * For Each vbc In ActiveWorkbook.VBProject.VBComponents * * * * If vbc.name = Worksheets(1).codeName Then * * * * * * pos = vbc.CodeModule.CreateEventProc("Change", "Worksheet") * * * * * * body = wsEvent * * * * * * vbc.CodeModule.InsertLines pos, body * * * * * * Exit For * * * * End If * * Next End Sub What am i doing wrong? Any help appreciated ojv- Nascondi testo citato - Mostra testo citato - Hi jk. I believe that my post of 5 July is valid, however for further informations, see: http://www.cpearson.com/excel/vbe.aspx Regards Eliano |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Insert Worksheet change procedure | Excel Programming | |||
Run procedure from worksheet change event | Excel Programming | |||
Validation Procedure with a worksheet change event | Excel Worksheet Functions | |||
Excel locks with Worksheet Change procedure | Excel Programming | |||
Worksheet change sub procedure | Excel Programming |