+ Reply to Thread
Results 1 to 4 of 4

naming a saved file

Hybrid View

mikeyfear naming a saved file 05-18-2008, 06:43 PM
Simon Lloyd This should do it for you! ... 05-18-2008, 08:03 PM
mikeyfear Thanks Simon. Just out of... 05-19-2008, 03:04 AM
Simon Lloyd This will save it to the same... 05-19-2008, 03:10 AM
  1. #1
    Registered User
    Join Date
    04-17-2008
    Location
    Yorkshire
    Posts
    79

    naming a saved file

    I have made a marco that writes a comparison report between two customers, and creates a new workbook and inserts the data.

    I want to save this file as "custA" "Vs" "custB" and the date.

    How would I go about doing this?

    For an example: If custA's name is in cell B2 an custB's name is is C2 in the active sheet?

    I know there are many example of this too, but I've tried adapting the exisiting ones without success.

    Thanks!

  2. #2
    Forum Expert Simon Lloyd's Avatar
    Join Date
    03-02-2004
    Location
    locked in the cage
    MS-Off Ver
    All the ones my homepage shows
    Posts
    3,161
    This should do it for you!
    ThisWorkbook.SaveAs (Range("B2").Value & " Vs " & _
    Range("C2").Value & "-" & Format(Date, "dd-mm-yyyy"))
    Not all forums are the same - seek and you shall find

  3. #3
    Registered User
    Join Date
    04-17-2008
    Location
    Yorkshire
    Posts
    79
    Quote Originally Posted by Simon Lloyd
    This should do it for you!
    ThisWorkbook.SaveAs (Range("B2").Value & " Vs " & _
    Range("C2").Value & "-" & Format(Date, "dd-mm-yyyy"))
    Thanks Simon. Just out of interest is there any method to display the current path a workbook is saved in?

    I'm thinking if I could look that up on my original workbook, set it as a string in the macro that crates a new one, then I could make it automatically save it in the same place as the original workbook that creates the new one.

  4. #4
    Forum Expert Simon Lloyd's Avatar
    Join Date
    03-02-2004
    Location
    locked in the cage
    MS-Off Ver
    All the ones my homepage shows
    Posts
    3,161
    This will save it to the same path as the original:
    ThisWorkbook.SaveAs (ThisWorkbook.Path & Range("B2").Value & " Vs " & _
    Range("C2").Value & "-" & Format(Date, "dd-mm-yyyy"))

+ 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