Results 1 to 2 of 2

Thread: Save macro not working

  1. #1

    Save macro not working

    Register for a FREE account, and/
    or Log in to avoid these ads!

    I made a quick macro to save an excel sheet to a certain location and with a certain name depending on the cell value. The macro is executed when I push a custom button on the quick access tool bar. It worked great for a while and now it is not working at all. It will close the document, but not save it. Any ideas what I could be missing?

    Sub ECN_SAVE()
    THISFILE = Range("R3").Value
    FILETHIS = Range("Q6").Value
    ActiveWorkbook.SaveAs Filename:="I:\ECN\New Ecn's\" & FILETHIS & "_" & THISFILE
    End Sub

    A little more background. I has this associated with an excel sheet that I saved and put in the excel start up folder. I tried changing it so the macro would be there with no docuements open. It worked twice and then stopped working. This should be able to run without a certain document open, right?

  2. #2
    Conjurer WizzardOfOz's Avatar
    Join Date
    Sep 2013
    Excel Version
    Office 365
    1: Stating the obvious you checked that the current workbook with the current sheet has defined R3 and Q6?

    2: Lost mapped drive/folder

    3: Reserved words/spaces in R3/Q6 I would wrap the whole thing in quotes
    sFilename = """" & "I:\ECN\New Ecn's\" & FILETHIS & "_" & THISFILE & """"

    Good idea to throw a check of
    if vbyes = msgbox("saving file to" & vbcrlf & sFilename",vbyesno,"Confirm saving location") then

    ActiveWorkbook.SaveAs Filename:= SFilename

    4: File already exisiting/ or admin write issues

Posting Permissions

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