Hi,
I am trying to add code to the sheet, which is dynamically getting created,
when i a executing the subroutine, am getting the error "Can't Enter Break Mode at this time"
at xLine = .CreateEventProc("Change", "Worksheet")
and folling is my code
Help please
Thanks
I am trying to add code to the sheet, which is dynamically getting created,
when i a executing the subroutine, am getting the error "Can't Enter Break Mode at this time"
at xLine = .CreateEventProc("Change", "Worksheet")
and folling is my code
Code:
Sub AddSht_AddCode(ByRef wb As Workbook)
Application.EnableEvents = True
Dim xPro As VBIDE.VBProject
Dim xCom As VBIDE.VBComponent
Dim xMod As VBIDE.CodeModule
Dim xLine As Long
'Set wb = Workbooks.Add
With wb
Set xPro = wb.VBProject
'Set xCom = xPro.VBComponents(ActiveSheet.CodeName)
Set xCom = xPro.VBComponents(Sheets("Node Pairing").CodeName)
Set xMod = xCom.CodeModule
With xMod
xLine = .CreateEventProc("Change", "Worksheet")
xLine = xLine + 1
.InsertLines xLine, " If SheetPresent(" & """" & "Mac Table" & """" & ") = True Then"
xLine = xLine + 1
.InsertLines xLine, " call NodeMacChange(Target)"
xLine = xLine + 1
.InsertLines xLine, " End If"
End With
End With
Application.EnableEvents = True
End Sub
Thanks