+ Reply to Thread
Results 1 to 4 of 4

"Save as" macro to desktop :-(

Hybrid View

  1. #1
    Registered User
    Join Date
    10-11-2012
    Location
    England
    MS-Off Ver
    MS Office 2016 (Home PC), MS Office (Work PC)
    Posts
    62

    "Save as" macro to desktop :-(

    Hello All,

    I am new to excel and Macro's so please bare with me

    I work with the same template every day and would like to know how to set up a macro that when i am finished it will save it to the desktop with a specific name i.e. date as 130204 Building Name/ Rev (As in revision).xls(?).

    I found a similair macro on the net but i just couldn't make the changes to get it to work

    Sub SaveWithName()
    ymd = Year(Now()) & Month(Now()) & Day(Now())
    buildingname = InputBox("Enter name of document", "Building Name")
    Revision = InputBox("Enter name of Revision", "Revision")
    fname = ymd & "-" & buildingname & "-" & Revision & ".xlsx"
    ActiveWorkbook.SaveAs Filename:=fname, FileFormat:=xlNormal
    End Sub

    Any help(Basic terminolgy) would be greatly appreciated

    Thanks

    Regards

    GC

  2. #2
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: "Save as" macro to desktop :-(

    Sub SaveWithName()
    fpath = "C:\users\name\Desktop\" ' <<< to be changed
    ymd = Year(Now()) & Month(Now()) & Day(Now())
    buildingname = InputBox("Enter name of document", "Building Name")
    Revision = InputBox("Enter name of Revision", "Revision")
    fname = fpath & ymd & "-" & buildingname & "-" & Revision & ".xlsx"
    ActiveWorkbook.SaveAs Filename:=fname, FileFormat:=xlNormal
    End Sub
    If solved remember to mark Thread as solved

  3. #3
    Registered User
    Join Date
    10-11-2012
    Location
    England
    MS-Off Ver
    MS Office 2016 (Home PC), MS Office (Work PC)
    Posts
    62

    Re: "Save as" macro to desktop :-(

    Patel45,

    Thanks, the file wont open after saving?

    something about file name and format?

  4. #4
    Forum Expert
    Join Date
    07-15-2012
    Location
    Leghorn, Italy
    MS-Off Ver
    Excel 2010
    Posts
    3,431

    Re: "Save as" macro to desktop :-(

    if you want save as xlsx you need FileFormat:= xlOpenXMLWorkbook not xlNormal

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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