exception at 0x6503999b (VBE6.DLL) - Please

F

Fred

I constantly get the following error when I get to
the ".InsertLines" of the code listed below the error.

Can anyone help
First-chance exception at 0x6503999b (VBE6.DLL) in
EXCEL.EXE: 0xC0000005: Access violation writing location
0x5c00800f.
Unhandled exception at 0x6503999b (VBE6.DLL) in EXCEL.EXE:
0xC0000005: Access violation writing location 0x5c00800f.

Sub Insert_Code()
Dim obvbc As VBIDE.VBComponent, lLine As Long
With Workbooks("Booked Sales by AS Rep Actuals.xls")
Set obvbc = .VBProject.VBComponents(.ActiveChart.CodeName)
End With
With obvbc.CodeModule
lLine = .CreateEventProc("Calculate", "chart")
.InsertLines lLine, "'Reset Custom Color Option"
.ReplaceLine lLine + 2, "ActiveChart.SeriesCollection
(1).Select" & vbCrLf & _
"If Selection.Interior.ColorIndex <> 23 Then" &
vbCrLf & _
" With Selection.Border" & vbCrLf & _
" .ColorIndex = 5" & vbCrLf & _
" .Weight = xlThin" & vbCrLf & _
" .LineStyle = xlContinuous" & vbCrLf & _
" End With" & vbCrLf & _
"Selection.Shadow = False" & vbCrLf & _
"Selection.InvertIfNegative = False" & vbCrLf & _
" With Selection.Interior" & vbCrLf & _
" .ColorIndex = 23" & vbCrLf & _
" .Pattern = xlSolid" & vbCrLf & _
" End With" & vbCrLf & _
"End If"
End With
Set obvbc = Nothing
End Sub
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top