Quantcast
Channel: Excel Help Forum - Excel Programming / VBA / Macros
Viewing all articles
Browse latest Browse all 50090

[SOLVED] Help with Error Handling

$
0
0
Hi All,
*
Firstly let me thanks to the admin and all the members for
their wonderful job which they are contributing in this great forum. I have
learnt a lot from all of you.

Please see below specific points for what I have and what I need, apologies in advance if I this is not very clear

I want a function where user has to get a msg " You are taking an incorrect worksheet and lal al "" instead of scary error message

I tried to create on but not working out here is the code

Code:


     
   
Sub Backupto_Server_ISF01()
'
' 10/29/2012
' vipin kamalasanan
' will save to specific path

'On Error GoTo ErrorHandler


Application.EnableCancelKey = xlDisabled
Windows("Production_Gen_Mac.xlsm").Activate
Dim strpath As String, strFileName As String
strpath = "\\is-fs01\Profiles\vkamalasanan\QA macro report\Pbyranaika\"
strFileName = Format(Now(), "yyyy-mm-dd") & "_" & ActiveWorkbook.Name
ActiveWorkbook.SaveAs Filename:= _
strpath & strFileName, FileFormat:=52, _
Password:="", WriteResPassword:="", ReadOnlyRecommended:=False, _
CreateBackup:=False

MsgBox ("Worksheet backup created and saved, Please close the generated file if not use")

If Err.Number = 9 Then

Dim msge As String

MsgBox ("You are trying to work on already saved sheet, please try in correct format")

End If


Viewing all articles
Browse latest Browse all 50090

Trending Articles