ehandler

O

Oldjay

If ehandler1 is activated I want to be able to have the option of going on to
the code below On Error GoTo ehandler2.

On Error GoTo ehandler1

quotenumber1 = InputBox("Please enter QUOTE file name to save to your C
drive & Server3", _
"X Technologies LLC", NUMBERSAVE)
QUOTE = "C:\Quick Quotes3\" & NUMBERSAVE & ".XLS"
ActiveWorkbook.SaveAs Filename:=QUOTE

On Error GoTo ehandler2

QUOTE1 = "\\server3\jobs\estimate1\Quick Quotes3\" & NUMBERSAVE & ".XLS"
ActiveWorkbook.SaveAs Filename:=QUOTE1
ActiveWorkbook.Close
'End 6/09/08 revision

Application.Goto Reference:="InPutForm"
Range("AB2").Select

MainMenu.Show vbModeless
Exit Sub

ehandler1:
MsgBox "You cancelled the save or an error has occured connecting to the
C:\Quick Quotes3\. Check your C: drive and try again ", vbCritical +
vbOKOnly, "File not saved!"

ActiveWorkbook.Close
Windows(MasterSheet).Activate
Sheets("Input").Select
MainMenu.Show vbModeless
Exit Sub

ehandler2:
MsgBox "You cancelled the save or an error has occured connecting to the
Server3. Check your connection and try again ", vbCritical + vbOKOnly, "File
not saved!"
ActiveWorkbook.Close
Windows(MasterSheet).Activate
Sheets("Input").Select
MainMenu.Show vbModeless
Exit Sub

Windows(MasterSheet).Activate
Sheets("Input").Select
MainMenu.Show vbModeless
End Sub
 
D

Dick Kusleika

On Tue, 10 Feb 2009 13:21:03 -0800, Oldjay

I think the best way is with one error handler. Since you're looking for
certain errors, just trap those specifically

On Error Resume Next
quotenumber1 = InputBox("Please enter QUOTE file name to save to your C
drive & Server3", _
"X Technologies LLC", NUMBERSAVE)
QUOTE = "C:\Quick Quotes3\" & NUMBERSAVE & ".XLS"
ActiveWorkbook.SaveAs Filename:=QUOTE
On Error Goto ErrHandler

If ActiveWorkbook.FullName <> QUOTE Then Err.Raise 9991

On Error Resume Next
QUOTE1 = "\\server3\jobs\estimate1\Quick Quotes3\" & NUMBERSAVE & ".XLS"
ActiveWorkbook.SaveAs Filename:=QUOTE1
On Error Goto ErrHandler

If ActiveWorkbook.Fullname said:
ActiveWorkbook.Close
'End 6/09/08 revision

Application.Goto Reference:="InPutForm"
Range("AB2").Select

MainMenu.Show vbModeless
Exit Sub

ErrHandler:
Select Case Err.Number
Case 9991
MsgBox "You cancelled the save or an error has occured connecting to the
C:\Quick Quotes3\. Check your C: drive and try again ", vbCritical +
vbOKOnly, "File not saved!"

ActiveWorkbook.Close
Windows(MasterSheet).Activate
Sheets("Input").Select
MainMenu.Show vbModeless
Exit Sub
Case 9992
MsgBox "You cancelled the save or an error has occured connecting to the
Server3. Check your connection and try again ", vbCritical + vbOKOnly, "File
not saved!"
ActiveWorkbook.Close
Windows(MasterSheet).Activate
Sheets("Input").Select
MainMenu.Show vbModeless
Exit Sub

Windows(MasterSheet).Activate
Sheets("Input").Select
MainMenu.Show vbModeless

Case Else
MsgBox Err.Description
End Select
 
O

Oldjay

Thanks

Dick Kusleika said:
On Tue, 10 Feb 2009 13:21:03 -0800, Oldjay

I think the best way is with one error handler. Since you're looking for
certain errors, just trap those specifically

On Error Resume Next
On Error Goto ErrHandler

If ActiveWorkbook.FullName <> QUOTE Then Err.Raise 9991

On Error Resume Next
On Error Goto ErrHandler



ErrHandler:
Select Case Err.Number
Case 9991

Case Else
MsgBox Err.Description
End Select
 

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

Top