+ Reply to Thread
Results 1 to 5 of 5

SaveAs macro works once only

  1. #1
    Forum Contributor
    Join Date
    12-02-2008
    Location
    Brisbane
    MS-Off Ver
    2016
    Posts
    811

    SaveAs macro works once only

    The code below runs once but once only. Second time it generates a syntax error at the ActiveWorkbook.SaveAs line.

    It is intended to save the file as macro-enabled using a given folder in FPath and a given name which comes from a cell in the spreadsheet. There are no illegal characters in either of those (so far as I can sell). I presume it has something to do with saving it with the same name as an open file but ?

    HTML Code: 

  2. #2
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,565

    Re: SaveAs macro works once only

    Hi BRISBANEBOB,

    Your code works for me

    Are you on the same sheet you were when you originally ran the macro as if you're on a different tab there may illegal characters on that tab as it uses the active tab??

    HTH

    Robert
    ____________________________________________
    Please ensure you mark your thread as Solved once it is. Click here to see how
    If this post helps, please don't forget to say thanks by clicking the star icon in the bottom left-hand corner of my post

  3. #3
    Forum Contributor
    Join Date
    12-02-2008
    Location
    Brisbane
    MS-Off Ver
    2016
    Posts
    811

    Re: SaveAs macro works once only

    Hi Robert

    The DataEntrySheet (where the FName range is) is on a separate tab but I still can't see any illegal characters. It saves fine from the DataEntrySheet when it is first saved and the when it attempts to save it again from a different sheet using the above code, it merely adds a reference ("-(FP)") and I can't see anything wrong there.

  4. #4
    Forum Contributor
    Join Date
    12-02-2008
    Location
    Brisbane
    MS-Off Ver
    2016
    Posts
    811

    Re: SaveAs macro works once only

    Solved. It turns out when you are saving to a SharePoint folder the syntax is slightly different.

    Thanks for your help, much appreciated

  5. #5
    Forum Expert
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    Office 365
    Posts
    3,565

    Re: SaveAs macro works once only

    I didn't do too much, but thanks anyway

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. Replies: 8
    Last Post: 02-19-2014, 09:55 AM
  2. SaveAs Macro
    By bhenderson in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-29-2011, 12:04 AM
  3. SaveAs Macro
    By sumitomo in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 09-12-2010, 04:54 PM
  4. SaveAs macro
    By mrggutz in forum Excel General
    Replies: 5
    Last Post: 08-09-2010, 11:54 AM
  5. [SOLVED] Saveas Macro
    By Nigel in forum Excel General
    Replies: 3
    Last Post: 05-11-2005, 09:06 AM

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