Save As Macro Help
Find bottlenecks in your Excel workbooks
Thanks Thanks:  0
Likes Likes:  0
Results 1 to 8 of 8

Thread: Save As Macro Help

  1. #1
    Board Regular
    Join Date
    Feb 2002
    Location
    Oklahoma
    Posts
    237
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

     
    I have the following code in a macro, and it worked once, and now will not. Can anyone offer a suggestion? I appreciate any help.

    ActiveWorkbook.SaveAs _
    FileName:="D:Personal" & Worksheets("Instructions") _
    .Range("DIVLOC").Value & "I.xls", _
    FileFormat:=xlNormal, _
    Password:="mfgie", _
    WriteResPassword:=""

  2. #2
    MrExcel MVP Russell Hauf's Avatar
    Join Date
    Feb 2002
    Location
    Portland, OR Area - USA
    Posts
    1,605
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    What problem are you having?

  3. #3
    Board Regular
    Join Date
    Feb 2002
    Location
    Oklahoma
    Posts
    237
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Well I am trying to name a file off a range name in another Workbook. Any ideas? I am essentially teaching myself VB as I go. I am very new, and liking what I am finding. Thanks for any help you can offer. -asa

  4. #4
    MrExcel MVP Russell Hauf's Avatar
    Join Date
    Feb 2002
    Location
    Portland, OR Area - USA
    Posts
    1,605
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    What is your code doing/not doing that it shouldn't/should do? What error are you getting?

  5. #5
    Board Regular
    Join Date
    Feb 2002
    Location
    Oklahoma
    Posts
    237
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    Well I have my code working now, but it is naming the file the wrong name. I want it to name what is in Cell A2, and it is naming the file InstructionsI. Thanks for your quick responses.

    ActiveWorkbook.SaveAs _
    FileName:="D:Personal " & Sheet1.Range("A2").Value & "I.xls", _
    FileFormat:=xlNormal, _
    Password:="", _
    WriteResPassword:=""

  6. #6
    Board Regular
    Join Date
    Feb 2002
    Location
    Oklahoma
    Posts
    237
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    I am now getting a Compile Error with this code. I know it is the weekend, so you guys and gals have a good one. See you all Monday. -asa

    ActiveWorkbook.SaveAs _
    FileName:="D:Personal &Worksheets("Sheet1").Range("A2").Value & "I.xls", _
    FileFormat:=xlNormal, _
    Password:="mfgie", _
    WriteResPassword:=""

  7. #7
    MrExcel MVP Russell Hauf's Avatar
    Join Date
    Feb 2002
    Location
    Portland, OR Area - USA
    Posts
    1,605
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

    On 2002-04-19 15:19, Aaron wrote:
    I am now getting a Compile Error with this code. I know it is the weekend, so you guys and gals have a good one. See you all Monday. -asa

    ActiveWorkbook.SaveAs _
    FileName:="D:Personal &Worksheets("Sheet1").Range("A2").Value & "I.xls", _
    FileFormat:=xlNormal, _
    Password:="mfgie", _
    WriteResPassword:=""
    On that code you're missing the double-quotes after Personal ... should be:

    FileName:="D:Personal" & Worksheets ...

    Sorry, am trying to get work finished here as I'm out next week. It looks like your code should work - what's in cell A2?

  8. #8
    Board Regular
    Join Date
    Feb 2002
    Location
    Oklahoma
    Posts
    237
    Post Thanks / Like
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Default

      
    Cell A2 is what I want my File name to be. I also have a string that I could use in cell A6, that I could use the first five Characters. Would I use the LEFT command like on a worksheet? Many thanks for all of your help. -asa

User Tag List

Like this thread? Share it with others

Like this thread? Share it with others

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

 

 
DMCA.com