+ Reply to Thread
Results 1 to 3 of 3

"saving as" with a macro

  1. #1
    Registered User
    Join Date
    07-21-2008
    Location
    london
    Posts
    5

    "saving as" with a macro

    Hi there,

    I have written a macro that modifies an excel file updating it with new data.

    What I would like to do is to save the file before my macro does all the updating so I keep an "screenshot" of the data so I can track it back.

    The closest I have got to it is the macro you can see below, which saves my file with the name I specify in cell A1 and date. So far all sounds good.

    My only problem is that after saving the file open in Excel is not the original one I was working on, is the new one with the name from the cell A1.

    Is there any way of saving a version of the doc you are working with another name but not opening it and keeping open the one you had.

    Does this makes sense any sense? Hope is not too confusing.

    Thanks for looking at this,


    Sub Macro1()


    'Saves filename as value of A1 plus the current date

    Dim newFile As String, fName As String
    ' Don't use "/" in date, invalid syntax
    fName = Range("A1").Value
    'Change the date format to whatever you'd like, but make sure it's in quotes
    newFile = fName & " " & Format$(Date, "mm-dd-yyyy")
    ' Change directory to suit your PC, including USER NAME
    ChDir _
    "C:\Documents and Settings\user\My Documents\"
    ActiveWorkbook.SaveAs Filename:=newFile

    End Sub
    Last edited by gresham; 04-08-2009 at 09:46 AM.

  2. #2
    Valued Forum Contributor mudraker's Avatar
    Join Date
    11-10-2003
    Location
    Melbourne, Australia
    Posts
    3,983

    Re: "saving as" with a macro

    Please take a couple of minutes and read ALL theForum Rules then wrap your VBA code (Rule 3)
    Please Read Forum Rules Before Posting
    Wrap VBA code by selecting the code and clicking the # icon or Read This
    How To Cross Post politely

    Top Excel links for beginners to Experts

    If you are pleased with a member's answer then use the Scales icon to rate it
    If my reply has assisted or failed to assist you I welcome your Feedback.

  3. #3
    Registered User
    Join Date
    07-21-2008
    Location
    london
    Posts
    5

    Re: "saving as" with a macro

    is it ok now?

    Cheers,

+ 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