Patrickll
02-17-2016, 04:21 PM
Hi, here is my situation. I am using a .deleteLines to delete certain lines of code in a Sub. Whenever the .deleteLines happens, a popup appears (added as a screenshot: 15425) mentioning Break is pretty much disabled going forward. From that moment, it is impossible for me to break at a specific line after the .deleteLines code line. My first question is: Is this avoidable? and 2nd question: If not, is there a way to reactivate Breaks?
Workbook1 opens Workbook 2 using Application.Run MacroName
MacroName (in Workbook2) uses the following code to delete certain lines:
ModuleName = "MyModule"
Set VBProj = ActiveWorkbook.VBProject
Set VBComp = VBProj.VBComponents(ModuleName)
Set CodeMod = VBComp.CodeModule
Dim SLS As Long ' start line
Dim SCS As Long ' start column
Dim ECS As Long ' end column
Dim SLE As Long ' start line
Dim SCE As Long ' start column
Dim ECE As Long ' end column
SLS = 1
SCS = 1
ECS = 255
SLE = 1
SCE = 1
ECE = 255
With CodeMod
FoundStart = .Find(Target:=StartCode & AddedVariable, StartLine:=SLS, StartColumn:=SCS, EndLine:=.CountOfLines, EndColumn:=ECS, wholeword:=True, MatchCase:=False, patternsearch:=False)
FoundEnd = .Find(Target:=EndCode & AddedVariable, StartLine:=SLE, StartColumn:=SCE, EndLine:=.CountOfLines, EndColumn:=ECE, wholeword:=True, MatchCase:=False, patternsearch:=False)
LineStart = SLS + 1
LineEnd = SLE - 1
NumberofLinestoDelete = SLE - LineStart
.DeleteLines LineStart, NumberofLinestoDelete
End With
Any help would be greatly appreciated!
Thanks
Workbook1 opens Workbook 2 using Application.Run MacroName
MacroName (in Workbook2) uses the following code to delete certain lines:
ModuleName = "MyModule"
Set VBProj = ActiveWorkbook.VBProject
Set VBComp = VBProj.VBComponents(ModuleName)
Set CodeMod = VBComp.CodeModule
Dim SLS As Long ' start line
Dim SCS As Long ' start column
Dim ECS As Long ' end column
Dim SLE As Long ' start line
Dim SCE As Long ' start column
Dim ECE As Long ' end column
SLS = 1
SCS = 1
ECS = 255
SLE = 1
SCE = 1
ECE = 255
With CodeMod
FoundStart = .Find(Target:=StartCode & AddedVariable, StartLine:=SLS, StartColumn:=SCS, EndLine:=.CountOfLines, EndColumn:=ECS, wholeword:=True, MatchCase:=False, patternsearch:=False)
FoundEnd = .Find(Target:=EndCode & AddedVariable, StartLine:=SLE, StartColumn:=SCE, EndLine:=.CountOfLines, EndColumn:=ECE, wholeword:=True, MatchCase:=False, patternsearch:=False)
LineStart = SLS + 1
LineEnd = SLE - 1
NumberofLinestoDelete = SLE - LineStart
.DeleteLines LineStart, NumberofLinestoDelete
End With
Any help would be greatly appreciated!
Thanks