Results 1 to 5 of 5

save as problem

Threaded View

keith.barnes save as problem 05-15-2022, 01:51 AM
AliGW Re: save as problem 05-15-2022, 03:01 AM
Croweater Re: save as problem 05-15-2022, 03:07 AM
BadlySpelledBuoy Re: save as problem 05-15-2022, 03:08 AM
Marc L Hi, try this ! 05-16-2022, 12:25 PM
  1. #1
    Registered User
    Join Date
    06-07-2014
    Location
    New Zealand
    MS-Off Ver
    excel 2019
    Posts
    4

    Question save as problem

    Hi Guys

    Can any one help with this problem please.

    Sample code:-

    Sub SaveAsExample()
         
        Dim FName           As String
        Dim FPath           As String
         
        FPath = "F:\quote"
        FName = Sheets("quote").Range("f2").Text
        ThisWorkbook.SaveAs FileName:=FPath & "\" & FName
      Dim wb As Workbook
     
    
        
        
        MsgBox "" & Range("f2").Value & " has been saved"
         
    End Sub
    This simple macro works the first time you save the file then the next time you save it you are presented with a "a file named **** already exists, do you want to replace it. yes/no/cancel.

    The problem is that if you press either "no" or "cancel" rather than "yes", a VB 400 error comes up.

    Question.

    Can i put some additional code in that prevents this VB 400 error comming up.

    Thanks in advance for any help.

    Regards

    Keith
    Last edited by AliGW; 05-15-2022 at 02:59 AM. Reason: Code tags added.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Save Problem
    By zrs in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 05-03-2019, 10:58 AM
  2. Save as PDF problem
    By thammondwis in forum Excel General
    Replies: 6
    Last Post: 04-15-2019, 11:25 AM
  3. before save problem
    By tmill29 in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 02-21-2014, 07:06 PM
  4. Save As problem
    By Bob@Sun in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-30-2010, 05:57 AM
  5. Problem with save xls into csv
    By mario99ukdw in forum Excel General
    Replies: 0
    Last Post: 10-29-2008, 02:53 AM
  6. Save as problem with Save In drop down box
    By Doug in forum Excel General
    Replies: 3
    Last Post: 03-16-2006, 10:50 AM
  7. save problem
    By Anthony in forum Excel General
    Replies: 3
    Last Post: 03-14-2005, 03:06 PM

Tags for this Thread

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1