J
josiah.mcdonald
I've read many similar posts on this subject but it seems this error
can have many different causes. I've created an Access DB that
generates Excel reports (Requirement). It happens on every other
report (Same rpt) beginning with the second one, it only corrects
itself though if press 'END' when the error message comes up. I've
noticed a symptom that tells me this error is going to occur and I
close the Excel file before it finishs and gets to the code that causes
the error. Below is the indication I'm going to get the error:
objRptWS.Activate
objRptWS.Range(objRptWS.Cells(5, 20), objRptWS.Cells(5,
21)).Select
With .Shapes(strBox1).TextFrame
.Characters.Text = " "
objRptWS.Shapes(strBox1).Select
ExecuteExcel4Macro "FORMULA(" & strJudge1 & ")"
.Characters.Font.Size = 12
.Characters.Font.NAME = "ToyotaKV"
.Characters.Font.Bold = True
.HorizontalAlignment = xlHAlignCenter
End With
Every other time is when it kind of skips the ExecuteExcel4Macro line
and does put the formula into the box. This is the indication however
the error happens later on in the code (The code itself is pretty long
so just including snippets if anyone needs more of the code to help me
please let me know). That code is:
For Each objChart In objRptWS.ChartObjects
If StrComp(objChart.NAME, "Chart 1") <> 0 Then
objRptWS.ChartObjects(objChart.NAME).Activate
ActiveChart.Axes(xlCategory).Select
Selection.TickLabels.Orientation = 90
Set objChart = Nothing
End If
Next objChart
The ActiveChart statement is the one the debugger highlights as the
culprit. Any help would be greatly appreciated
can have many different causes. I've created an Access DB that
generates Excel reports (Requirement). It happens on every other
report (Same rpt) beginning with the second one, it only corrects
itself though if press 'END' when the error message comes up. I've
noticed a symptom that tells me this error is going to occur and I
close the Excel file before it finishs and gets to the code that causes
the error. Below is the indication I'm going to get the error:
objRptWS.Activate
objRptWS.Range(objRptWS.Cells(5, 20), objRptWS.Cells(5,
21)).Select
With .Shapes(strBox1).TextFrame
.Characters.Text = " "
objRptWS.Shapes(strBox1).Select
ExecuteExcel4Macro "FORMULA(" & strJudge1 & ")"
.Characters.Font.Size = 12
.Characters.Font.NAME = "ToyotaKV"
.Characters.Font.Bold = True
.HorizontalAlignment = xlHAlignCenter
End With
Every other time is when it kind of skips the ExecuteExcel4Macro line
and does put the formula into the box. This is the indication however
the error happens later on in the code (The code itself is pretty long
so just including snippets if anyone needs more of the code to help me
please let me know). That code is:
For Each objChart In objRptWS.ChartObjects
If StrComp(objChart.NAME, "Chart 1") <> 0 Then
objRptWS.ChartObjects(objChart.NAME).Activate
ActiveChart.Axes(xlCategory).Select
Selection.TickLabels.Orientation = 90
Set objChart = Nothing
End If
Next objChart
The ActiveChart statement is the one the debugger highlights as the
culprit. Any help would be greatly appreciated