LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 360
Default on error resume next

I have this module that runs when an option button is clicked on a user
form. There is a done and cancel button also.
It runs well, the only time it doesn't run is if the user opens the wrong
workbook. I noticed when this happens that Excel doesn't quit the form. It
might be fixed now but I thought I would put in "on error resume next"?
Basically if the first macro doesn't run correctly then the other two don't
need to run either. Should I just put the resume next enclosed in the
if/then or after every procedure?
Thanks,

--------macro----------
Sub optReformatDepts_Click()

If Fprocess1 = True And Fprocess2 = True Then
Fprocess3 = False

If optReformatDepts.Value = True Then

Call ReformatDepts.ColorDivHeaders
On Error Resume Next
Call ReformatDepts.StatusRowHeader
On Error Resume Next
Call ReformatDepts.HideXtraColumns
On Error Resume Next
Call ReformatDepts.ReportSetup
Fprocess3 = True

End If
Else
MsgBox "Please check for duplicates and save first."
End If

End Sub


--------whole user form-----------

Dim Fprocess1 As Boolean
Dim Fprocess2 As Boolean
Dim Fprocess3 As Boolean






Sub cmdCancel_Click()

If MsgBox("Are you sure you want to cancel?", _
vbYesNo + vbQuestion, _
"Cancel") = vbYes Then Unload Me
End Sub

Sub cmdOkay_Click()

If Fprocess1 = True And Fprocess2 = True And Fprocess3 = True Then
Unload Me
Else
MsgBox " All options must be completed before closing"
End If

End Sub



Sub optCkforDupes_Click()
Dim nResult As Long
Debug.Print frRptDate
Debug.Print toRptDate
Fprocess1 = False

If optCkforDupes.Value = True Then
nResult = MsgBox(prompt:="From: " & FrReptDate & vbNewLine & "To: " &
ToReptDate, Buttons:=bvOKCancel, Title:="report Date")

End If
If nResult = vbOK Then

Call createXLdb.CkforDupes
Fprocess1 = True
End If

End Sub

Sub optSaveIndesign_Click()
If Fprocess1 = True Then
Fprocess2 = False

If optSaveIndesign.Value = True Then
Call saveIndesign.saveIndesign
Fprocess2 = True
End If
Else
MsgBox "Please check for duplicates first."
End If
End Sub
Sub optReformatDepts_Click()

If Fprocess1 = True And Fprocess2 = True Then
Fprocess3 = False

If optReformatDepts.Value = True Then

Call ReformatDepts.ColorDivHeaders
On Error Resume Next
Call ReformatDepts.StatusRowHeader
On Error Resume Next
Call ReformatDepts.HideXtraColumns
On Error Resume Next
Call ReformatDepts.ReportSetup
Fprocess3 = True

End If
Else
MsgBox "Please check for duplicates and save first."
End If

End Sub

Private Sub UserForm_Click()

End Sub

 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
On Error {...} Resume Next Edd[_2_] Excel Programming 2 March 15th 06 11:09 PM
On Error Resume Next ? Nigel Excel Programming 4 August 11th 05 09:07 AM
On Error Resume Next Stefi Excel Programming 6 July 8th 05 11:52 AM
On Error Resume Next Jim Sharrock Excel Programming 2 May 13th 04 03:12 PM
On Error Resume Next D.S.[_3_] Excel Programming 1 November 28th 03 04:52 PM


All times are GMT +1. The time now is 10:08 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"