#1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 337
Default ehandler

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

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 595
Default ehandler

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

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 < QUOTE Then Err.Raise 9992

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
End Sub

--
Dick Kusleika
Microsoft MVP-Excel
http://www.dailydoseofexcel.com
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 337
Default ehandler

Thanks

"Dick Kusleika" wrote:

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

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 < QUOTE Then Err.Raise 9992

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
End Sub

--
Dick Kusleika
Microsoft MVP-Excel
http://www.dailydoseofexcel.com

Reply
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
Ehandler Oldjay Excel Programming 1 February 10th 09 09:25 PM


All times are GMT +1. The time now is 08:02 PM.

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"