Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Error Handling 1

Status
Not open for further replies.

JohnAcc

Technical User
Aug 13, 2003
143
GB
Hi There,

I have the following sub that is causing me problems - when an error occurs it behaves as expected but when an error doesn't occur it still triggers the error handler - Any ideas ????


Private Sub btnConfirm_Click()
On Error GoTo ErrHandler
ActiveSheet.ChartObjects("Chart 1").Activate
With ActiveChart.Axes(xlValue, xlSecondary)
.MinimumScale = fmAxisBox.Min.Value
.MaximumScale = fmAxisBox.Max.Value
End With
fmAxisBox.Min.Value = ""
fmAxisBox.Max.Value = ""
Sheets("Charts").Axis2_Scale.Value = False
fmAxisBox.Hide
Close_ActiveChart
ErrHandler:
fmAxisBox.Min.Value = ""
fmAxisBox.Max.Value = ""
fmAxisBox.Hide
MsgBox " Unable to set the Second Axis Parameters Specified", vbCritical, "Error on Secondary Axis"
Sheets("Charts").Axis2_Scale.Value = False
Close_ActiveChart
On Error GoTo 0
End Sub
 
After this line:
Close_ActiveChart

have
Exit sub

The error handler is only really a goto line so unless you jump the error handler, it will run through it anyway

Rgds, Geoff
[blue]Si hoc signum legere potes, operis boni in rebus Latinus alacribus et fructuosis potiri potes![/blue]
Want the [red]best[/red] answers to your questions ? faq222-2244
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top