Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 337
Default Error Message

Using Excel 2007 and Win 7
The following macro has suddenly started displaying the error message even
thou the file is saved correctly to the server.
Private Sub CommandButton4_Click() 'Save Work Master

Application.ScreenUpdating = False
Application.DisplayAlerts = False

ActiveWorkbook.SaveAs Filename:="C:\Quotes\Master7.xlsm"

On Error GoTo ehandler

ActiveWorkbook.SaveAsFilename:="\\SERVER3\JOBS\EST IMATE1\Master7.xlsm"
Range("A1").Select
Range("A5").Select

ehandler:

MsgBox "You cancelled the save or an error has occured connecting to the
server. Check your connection and try again ", vbCritical + vbOKOnly, "File
not saved!"

End Sub
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,510
Default Error Message

Hi oldjay,

The msgbox is the next line of code so it will always execute. You need an
Exit Sub immediately prior to label ehandler: so that it only processes code
past the label if it is sent there by the error.


Exit Sub
ehandler:

--
Regards,

OssieMac


"oldjay" wrote:

Using Excel 2007 and Win 7
The following macro has suddenly started displaying the error message even
thou the file is saved correctly to the server.
Private Sub CommandButton4_Click() 'Save Work Master

Application.ScreenUpdating = False
Application.DisplayAlerts = False

ActiveWorkbook.SaveAs Filename:="C:\Quotes\Master7.xlsm"

On Error GoTo ehandler

ActiveWorkbook.SaveAsFilename:="\\SERVER3\JOBS\EST IMATE1\Master7.xlsm"
Range("A1").Select
Range("A5").Select

ehandler:

MsgBox "You cancelled the save or an error has occured connecting to the
server. Check your connection and try again ", vbCritical + vbOKOnly, "File
not saved!"

End Sub

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 337
Default Error Message

You saved me again OzzieMac = Thanks

"OssieMac" wrote:

Hi oldjay,

The msgbox is the next line of code so it will always execute. You need an
Exit Sub immediately prior to label ehandler: so that it only processes code
past the label if it is sent there by the error.


Exit Sub
ehandler:

--
Regards,

OssieMac


"oldjay" wrote:

Using Excel 2007 and Win 7
The following macro has suddenly started displaying the error message even
thou the file is saved correctly to the server.
Private Sub CommandButton4_Click() 'Save Work Master

Application.ScreenUpdating = False
Application.DisplayAlerts = False

ActiveWorkbook.SaveAs Filename:="C:\Quotes\Master7.xlsm"

On Error GoTo ehandler

ActiveWorkbook.SaveAsFilename:="\\SERVER3\JOBS\EST IMATE1\Master7.xlsm"
Range("A1").Select
Range("A5").Select

ehandler:

MsgBox "You cancelled the save or an error has occured connecting to the
server. Check your connection and try again ", vbCritical + vbOKOnly, "File
not saved!"

End Sub

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
Error Handler displaying message when no error Code Numpty Excel Programming 5 September 28th 09 07:25 PM
replace VBA run-time error message with custom message BEEJAY Excel Programming 13 July 14th 06 03:59 PM
error message: compile error, argument not optional Pierre via OfficeKB.com Excel Programming 3 September 5th 05 03:45 PM
changing the message in an error message The Villages DA Excel Worksheet Functions 2 February 18th 05 06:30 PM
How do I get rid of "Compile error in hidden module" error message David Excel Discussion (Misc queries) 4 January 22nd 05 12:39 AM


All times are GMT +1. The time now is 04:52 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"