How do I get my macro to stop if i cancel save a copy

Posted by total newbie on Stack Overflow See other posts from Stack Overflow or by total newbie
Published on 2009-12-30T10:11:49Z Indexed on 2010/05/03 7:38 UTC
Read the original article Hit count: 244

Filed under:
|
|

Greetings one and all - a christmas puzzle for anyone still looking at this site...This works but if i decide to cancel the process (ie not save a file and stop the process at this stage) it doesn't svae the file but the following marco (filltolastrow2) is still activated how can I stop this happening?

Public Sub SaveaCopyIncomeSheet()
    Dim file_name As Variant
    file_name = Application.GetSaveAsFilename("Overdue Report - Draft", filefilter:="Excel Files(*.xls),*.xls")
    If file_name <> False Then
       ActiveWorkbook.SaveAs Filename:=file_name
        MsgBox "File Saved!"
    End If
    filltolastrow2
End Sub 

© Stack Overflow or respective owner

Related posts about vba

Related posts about excel