Error Message

O

oldjay

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\ESTIMATE1\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
 
J

John Bundy

Depending on the error, i am bettin that it is because you turned off screen
updating and alerts and never turned em back on. That is unless you are
getting your own msgbox error.
 
O

OssieMac

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:
 
O

oldjay

You saved me again OzzieMac = Thanks

OssieMac said:
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:
 

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