Save a File to a Specific location Using a Macro in Excel




About this tutorial:

Video duration: 7:48
Save a File Using a Macro in Excel, Save a file to a particular location using a macro. Save a file as a particular type using a macro. For more help Visit our website
or email easyexcelanswers@gmail.com

MY videos are all created on Camtasia.

Check out my courses
Introduction to Excel
Intermediate Excel

Follow me on Facebook

Incoming search terms:

Post Author: OfficeTutes.com

Apple lover, ICT and LEAN consultant, MS Office lecturer My other website with video tutorials - Tutorials, guides and news for iPhones and iPads

41 thoughts on “Save a File to a Specific location Using a Macro in Excel

    DUBYA RX

    (December 26, 2018 - 1:45 am)

    thanks Barb. at the end after pressing button a blank screen appears. i see it in your vid as well. how can that be deleted along with hitting save button ?
    recent subscriber
    Tom

    Zsolt Farkas

    (December 26, 2018 - 1:45 am)

    Thanks it helped me too, but with this is easier : ActiveWorkbook.SaveAs filename:=path & filename1 & ".xlsm"

    Dipankar Manna

    (December 26, 2018 - 1:45 am)

    Can you help

    Dipankar Manna

    (December 26, 2018 - 1:45 am)

    Do not

    srinivasa kv

    (December 26, 2018 - 1:45 am)

    Thanks…

    Nigel Kheng

    (December 26, 2018 - 1:45 am)

    When I hover over the button, it doesn’t turn over for me to click on it. It has the symbol that allows me to reshape

    hashim khan

    (December 26, 2018 - 1:45 am)

    thank you so much, mam, but I want to save in Microsoft Word so please teach me how? I hope u will send me to reply soon.

    Mohammad Tahir

    (December 26, 2018 - 1:45 am)

    Bundle of thanks. It turn my hour work to minutes. thanks again

    thres34

    (December 26, 2018 - 1:45 am)

    You deserve a place in heaven , many thanks for you video

    Enrique Agüeros

    (December 26, 2018 - 1:45 am)

    Thanks Barb!

    Matthew Murphy

    (December 26, 2018 - 1:45 am)

    does this work with a multiple worksheet workbook?
    do you have to define which worksheet your using or is it associated with the command button ?

    Tim Eric

    (December 26, 2018 - 1:45 am)

    Great tutorial very helpful, I'm new to the world of Marcos in excel.
    I am trying to stream line my job by learning how to write amazing little programs like this and stop carry over mistakes.

    How would one write a code to do the same job essentially, but go one step further to populate information from the original document.
    Scenario, there is a "client registry" which has various bits of information regarding the client, and I need to execute a function to take those bits of information and populate them into a template sheet and save as a new file. let me know if you have any advice on this one or links to similar vids.

    JCarlos Ferreira

    (December 26, 2018 - 1:45 am)

    Hi Barb
    This is possible to save at OneDrive and two or more people using at the same time?

    crazy veenz143

    (December 26, 2018 - 1:45 am)

    Can you pl share code

    Ritesh Mishra

    (December 26, 2018 - 1:45 am)

    Love it!really very helpful👍thanx!

    Paula Samson

    (December 26, 2018 - 1:45 am)

    Excellent – very clear instructions given at a good pace.

    pvaldeben01

    (December 26, 2018 - 1:45 am)

    Worked for me. I gt stuck on the difference between xlsm and xlsx. But i'm all good now. Than you for creating this video.

    Joe Smith

    (December 26, 2018 - 1:45 am)

    AMAZING video. You earned a subscriber and a thumbs up.

    Tyler Cooper

    (December 26, 2018 - 1:45 am)

    Hi Barb,Thank you very much for your video! Could you help me trouble shoot?I have an Error called Run-time error '1004':Method 'SaveAs' of object '_Workbook' failI have gone over the code several times and have looked through other comments but couldn't find this. I included the "/" at the end of the file name.I appreciate your time,Tyler

    Arunkumar Km

    (December 26, 2018 - 1:45 am)

    Hi Barb,
    nice tutorial, and thanks for uploading this video, and i have a doubt for save invoice data to next sheet using macro, i.e i want to create invoice 10 invoices per day, i want to bake up the data to next sheet, below codes are am using but not working properly, i would like to request if you upload any video what am ask, kindly share the link to me
    Sub transfer()

    'Copy the data
    Sheets("Sheet2").Range("E22:M22").Copy
    'Activate the destination worksheet
    Sheets("SOA").Activate
    'Select the target range
    Range("E6").Select
    'Paste in the target destination
    ActiveSheet.Paste

    Application.CutCopyMode = False

    End Sub

    thanks,
    Arunkumar K.M

    Kirti Dhruv

    (December 26, 2018 - 1:45 am)

    How can I change the naming convention. I don't want it to pickup from excel sheet. Please suggest

    Just a guy

    (December 26, 2018 - 1:45 am)

    Say I have a value in A1 called Test and I want it to create a folder called Test where it saves itself as Test.xlsx in the defined path, is there a possibility to do this? I've been trying to look for a way to accomplish this for like 3 days.

    Kamrul Zoha

    (December 26, 2018 - 1:45 am)

    From long time I want to find the way how to save as file with a cell reference
    I mean
    I copy and paste the path in Sheet 2, R1C1
    And I want to save my Sheet 1 content as PDF.
    How I can make this ?

    Kamrul Zoha

    (December 26, 2018 - 1:45 am)

    How to save as PDF file ??

    JCarlos Ferreira

    (December 26, 2018 - 1:45 am)

    Your video is very good. excellent speech. Thank you – If you can do another video showing saving with conditions would be great.

    Aniruddha Raje

    (December 26, 2018 - 1:45 am)

    Thank you so much for uploading this video.. It helped me a lot…

    mf675913

    (December 26, 2018 - 1:45 am)

    Barb,
    Awesome videos. I tried using this information on a Trivia Night Score Sheet I created. Only issue I have is that a blank Excel window opens after the save and my original file closes. I'll send an email with more background information. Again, thanks for the very informative videos.

    Mrinmoy Halder

    (December 26, 2018 - 1:45 am)

    I've made a folder in D drive & mentioned that folder's address in macro, but file is saving in C:Document instead of this specified location.please help me

    JKhair

    (December 26, 2018 - 1:45 am)

    Hi Barb,

    I am getting error in below line
    ActiveWorkbook.SaveAs Filename:"path & filename1 & ".xlsx",

    ValmisFilm

    (December 26, 2018 - 1:45 am)

    Guys – watch out! There is one bad thing with that – I made the script and when I tested it well – it closed the file I was maing the code and I lost the code, because the file it saves does not have the VBA codes… so yeah, watch out!

    ValmisFilm

    (December 26, 2018 - 1:45 am)

    Thanks! Very nice!

    Saurabh D

    (December 26, 2018 - 1:45 am)

    Hi Barb, is there a way to save a file without any name parameter to a particular directory. I already have the filename but different each time.

    nmv

    (December 26, 2018 - 1:45 am)

    Hi barb,

    I have a issue. I am automating a webpage to download a document from it using a vba script. I can click the download option but upon clicking i get a pop below the window like, { open, save as and close}. Alt + S works fine for saving the document. Can you provide me a solution for how to go about it! I have tried using send keys but in vain

    Nowfal Beary

    (December 26, 2018 - 1:45 am)

    Hi,
    Can U pls Help me..?? 1.I have Many Sheets In One Work Book. So, I want to Save A Range Instead Of Entire WorkBook. 2.After Saving The New Saved File Opens And The Old One Closes. Pls Help me.

    Zamasu

    (December 26, 2018 - 1:45 am)

    Thanks

    Joshua Fong

    (December 26, 2018 - 1:45 am)

    Barb,

    Thank you for making this video! If possible, it would be really helpful if you showed how to do this on Excel 2016 for Mac.

    Sophie Udubasceanu

    (December 26, 2018 - 1:45 am)

    Hi Barb, sorry i come asking for help once again, im trying to use VBA to copy and paste over some cells but paste as values. i did do it by running macro record. im getting an error when the robot tries to go to the next sheet. any ideas?
    code below:
    Private Sub CommandButton2_Click()

    Sheets("1230").Range("B4:K4").Select
    Selection.Copy
    Range("B4:K4").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
    :=False, Transpose:=False
    Range("B15:G15").Select
    Application.CutCopyMode = False
    Selection.Copy
    Application.CutCopyMode = False
    Selection.Copy
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
    :=False, Transpose:=False
    Application.CutCopyMode = False
    Sheets("1030").Range("B4:K4").Select
    Selection.Copy
    Range("B4:K4").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
    :=False, Transpose:=False
    Range("B15:G15").Select
    Application.CutCopyMode = False
    Selection.Copy
    Range("B15:G15").Select
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
    :=False, Transpose:=False
    Application.CutCopyMode = False
    Sheets("1230").Select
    End Sub

    The error i get is "1004" Select method of range class failed.

    Sophie Udubasceanu

    (December 26, 2018 - 1:45 am)

    Hi Barb! Thanks for the tutorial, I am trying to use it but there is an issue with my code, something to do with the fileformat. I tried to set to code so it saves as a marco enabled one, then a non-macro one, i keep getting an error. see below

    Private Sub CommandButton1_Click()
    Dim path As String
    Dim filename1 As String
    path = "S:Datastore30. Crude8. Kapow"
    filename1 = "Exchange Close"
    Application.DisplayAlerts = False
    ActiveWorkbook.SaveCopyAs filename:=path & filename1 & ".xlsx", FileFormat:=xlOpenXMLWorkbookMacroEnabled, CreateBackup:=False
    Application.DisplayAlerts = True
    ActiveWorkbook.Close
    End Sub

    Thanks for your help

    adam hennessey

    (December 26, 2018 - 1:45 am)

    i need your help!! the Save command macro works. that's the good part. the bad part is that each saved file overrides the other. we are going to use this to keep a daily report, and each report has to be looked at from time to time.

    Connie Jacobo

    (December 26, 2018 - 1:45 am)

    can you help me with this:

    I have to gather 13 vendor reports each report is for last month.
    I then manually update a master report with some data from each of the vendor reports.

    I am writing a macro to read from an "Update Report" Tab in Master Report
    A1 = 2017 (current Year
    A2 = June (current Month)
    A3 = File Name
    A4 = FolderName
    A5 = Director (main pathway to all the folders

    This is what my record macro gave me:
    'Go to last row, Average AWP (A8)
    Sheets("Sheet1").Select 'this is the sheet the Vendor data is place in
    Range("A8").Select
    Selection.End(xlToRight).Select

    'Calculation
    'Average (A8)
    ActiveCell.Offset(0, 1).Select
    ActiveCell.FormulaR1C1 = _
    "='[ABCVendor June 2017 Claims.xlsx]TabName'!R10C2/'[ABCVendor June 2017 Claims.xlsx]TabName'!R8C2"
    Selection.Style = "Currency"

    BUT I need the macro to update for each month, because the name of the report changes from month to month.

    Can you help me with this?

    Connie Jacobo

    (December 26, 2018 - 1:45 am)

    I need to save the a file as .xlsm. the "FileFormat:=xlOpenXMLWorkbook" isn't working. What should I change it to?

Leave a Reply

Your email address will not be published. Required fields are marked *