Error Checking in Excel
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 2 of 2

Thread: SavAs

  1. #1
    New Member
    Join Date
    Mar 2002
    Posts
    2
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Public Sub SaveAsA1()
    ThisFile = Range("A1").Value
    ActiveWorkbook.SaveAs Filename:=ThisFile
    End Sub

    I am using the above macro in my spread sheet. If you have saved a file it asks if you wish to over write and if you say no or cancel it kicks the debugger on. How do I avoid this or get pass the error?

  2. #2
    MrExcel MVP
    Join Date
    Feb 2002
    Location
    Sydney, Australia
    Posts
    2,940
    Post Thanks / Like
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)

    Default

    Hi,

    You just need to use Application.DisplayAlerts=False e.g.

    Public Sub SaveAsA1()
    ThisFile = Range("A1").Value
    Application.DisplayAlerts = False
    ActiveWorkbook.SaveAs Filename:=ThisFile
    Application.DisplayAlerts = True
    End Sub

    HTH,
    D

Some videos you may like

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •