Results 1 to 4 of 4

Thread: VBA code to Save As in Current Folder and a Cell Dependent Name
Thanks Thanks: 0 Likes Likes: 0

  1. #1
    New Member
    Join Date
    May 2019
    Posts
    11
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default VBA code to Save As in Current Folder and a Cell Dependent Name

    Hello

    I was wondering how to make a macro SaveAs my file into the folder that my main file is in. Currently my code saves to my documents folder.
    My current code:

    Sub SaveAs()
    ActiveWorkbook.Save
    ThisFile = Range("B4").Value & Range("B8").Value
    ActiveWorkbook.SaveAs Filename:=ThisFile
    End Sub

    Thanks

  2. #2
    Board Regular
    Join Date
    Apr 2010
    Posts
    167
    Post Thanks / Like
    Mentioned
    6 Post(s)
    Tagged
    0 Thread(s)

    Default Re: VBA code to Save As in Current Folder and a Cell Dependent Name

    Quote Originally Posted by NSegna View Post
    Hello

    I was wondering how to make a macro SaveAs my file into the folder that my main file is in. Currently my code saves to my documents folder.
    My current code:

    Sub SaveAs()
    ActiveWorkbook.Save
    ThisFile = Range("B4").Value & Range("B8").Value
    ActiveWorkbook.SaveAs Filename:=ThisFile
    End Sub

    Thanks

    Code:
    Sub SaveAs()
        Application.DisplayAlerts = False
        ActiveWorkbook.SaveAs Filename:=ThisWorkbook.Path & "\" & ThisWorkbook.Name
        'ActiveWorkbook.SaveAs Filename:=ThisWorkbook.FullName 'This would accomplish the same thing as above
        Application.DisplayAlerts = True
    End Sub
    Last edited by Steve_; Aug 1st, 2019 at 02:51 PM.

  3. #3
    New Member
    Join Date
    May 2019
    Posts
    11
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default Re: VBA code to Save As in Current Folder and a Cell Dependent Name

    Hello Steve

    The code works perfectly

    Thank you very much

  4. #4
    Board Regular
    Join Date
    Apr 2010
    Posts
    167
    Post Thanks / Like
    Mentioned
    6 Post(s)
    Tagged
    0 Thread(s)

    Default Re: VBA code to Save As in Current Folder and a Cell Dependent Name

    Quote Originally Posted by NSegna View Post
    Hello Steve

    The code works perfectly

    Thank you very much
    Happy to help! Feel free to throw a like on the code.

Some videos you may like

User Tag List

Tags for this Thread

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
  •