+ Reply to Thread
Results 1 to 3 of 3

Saving with Macro

  1. #1
    Registered User
    Join Date
    05-10-2006
    Posts
    59

    Saving with Macro

    Hi

    Is it possible to use a macro to retrieve a value within a specific cell and save the workbook using that value for the file name?

    For example if the cell A1 had the value details, then the macro would save the workbook as details.xls

    Thank you in advance for any help !!

  2. #2
    Dave O
    Guest

    Re: Saving with Macro

    Here's some code you can use to get going: you may need to alter it to
    have it perform to your specs. You can specify a folder location with
    the NewPath variable; when you run this, the file is saved using the
    value of cell A1 as filename. Let us know if we can provide additional
    help:

    Sub SaveAs()
    Dim NewPath As String
    Dim NewFileName As String

    NewPath = "c:\"

    NewFileName = Range("a1").Value

    ActiveWorkbook.SaveAs Filename:=NewPath & NewFileName, _
    FileFormat:=xlNormal, Password:="", WriteResPassword:="", _
    ReadOnlyRecommended:=False, CreateBackup:=False

    End Sub


  3. #3
    Registered User
    Join Date
    05-10-2006
    Posts
    59
    Hi Thank you for the fast reply.

    I have found out another way to do this which is this:

    Sub SaveName()

    ActiveSheet.Range("B4").Select
    FileName = "H:\E5\Test\" & ActiveCell & ".xls"
    ActiveWorkbook.SaveAs FileName:=FileName
    End Sub

    I prefer your way though as it looks a little bit more structured.

    Thank you so much for your help !!!!

+ 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