Ask Experts Questions for FREE Help !
Ask
    rsdjimbie's Avatar
    rsdjimbie Posts: 96, Reputation: 3
    Junior Member
     
    #1

    May 5, 2009, 11:49 AM
    Macro to save a file name as per a cell content.
    I have a macro saving the file auto. To my desktop.

    For example cell A1 = 501

    I run a macro with a counter and auto. Changes A1 to 502.

    Now macro must change file saving to 502, or =cell A1 content.

    I also sometimes have to change destination from desktop to a specific file.
    JBeaucaire's Avatar
    JBeaucaire Posts: 5,426, Reputation: 997
    Software Expert
     
    #2

    May 5, 2009, 05:02 PM
    Quote Originally Posted by rsdjimbie View Post
    I have a macro saving the file auto. To my desktop.

    For example cell A1 = 501

    I run a macro with a counter and auto. Changes A1 to 502.

    Now macro must change file saving to 502, or =cell A1 content.
    Building on what we've done earlier, something like this should give an idea of the syntax:
    Code:
    Sub Save()
    Dim fName As String, DTAddress As String
    DTAddress = CreateObject("WScript.Shell").SpecialFolders("Desktop") & Application.PathSeparator
    fName = Range("A1").Text
    
        ActiveWorkbook.SaveAs DTAddress & fName & ".xls"
    
    End Sub
    I also sometimes have to change destination from desktop to a specific file.
    Change how? Clarify your work process or desired methodology.
    rsdjimbie's Avatar
    rsdjimbie Posts: 96, Reputation: 3
    Junior Member
     
    #3

    May 5, 2009, 11:40 PM

    File save as: My documents->Renier-> Production management->May
    JBeaucaire's Avatar
    JBeaucaire Posts: 5,426, Reputation: 997
    Software Expert
     
    #4

    May 6, 2009, 09:06 AM

    Riddles and more riddles.

    If you occasionally want to save the file to a different place and NOT use your macros normal methodology, then don't use your macro.

    Click on File > Save and pick you path / filename.

Not your question? Ask your question View similar questions

 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.


Check out some similar questions!

File saving macro [ 3 Answers ]

How do I change the following code so all pc's on network can run macro and have it saved on their desktops? ActiveWorkbook.SaveAs Filename:= _ "C:\Documents and Settings\User1\Desktop\FAWU", FileFormat _ :=xlNormal, Password:="", WriteResPassword:="", ReadOnlyRecommended:= _ ...

Cell references within VBA in an Excel macro [ 1 Answers ]

In a macro in Excel I want to refer to a cell where the user entered a number. I want that number to be the row number for the macro to move to. (I will then select the entire row and copy it to row 1, which I know how to do). How can I tell the macro which row to go to, using the number...

Cell to trigger a macro [ 2 Answers ]

Hi there I am newbie here and I have a question regarding Excel VBA. Though I done a search, but none of it could meet what I wanted. My request is.. Let say I enter value in A1 & B1. In cell C1, I have a formula, =sum(A1:B1), which is the total. Now, I want to create a event change (VBA)...

Excel: Deleted cell content but link is still there [ 3 Answers ]

When I delete text from a cell where the text was a hyperlink, it does go away, but when I go to type new text in the cell, the new text is hyperlinked as the former text was. How can I stop this from happening? Thanks!

Chose to save the Desktop content Offline. [ 1 Answers ]

I chose to save the Desktop content offline accidentally. I have a Windows 98 SE computer. A prompt window appears when I turn on my computer. It states that no connection to the internet is currently available. Click Offline to view Internet content that has been saved on your computer....


View more questions Search