Consulting

Results 1 to 5 of 5

Thread: Saving file with new name

  1. #1
    VBAX Regular
    Joined
    Feb 2008
    Posts
    58
    Location

    Saving file with new name

    I've gotten this to work, but it seems to take longer than I expected to execute. Is there something that I can do to make it run quicker?

    [vba]Sub Save()
    Dim newFile As String
    Dim faName As String
    Dim fbName As String

    Application.ScreenUpdating = False

    faName = Range("H2").Value
    fbName = Range("H4").Value

    newFile = Format$(Date, "YYYYMMDD") & " " & faName & " " & fbName

    ChDir "E:\"
    ActiveWorkbook.SaveAs Filename:=newFile

    MsgBox ("Review logged as " & newFile)

    Application.ScreenUpdating = True

    End Sub
    [/vba]

  2. #2
    Distinguished Lord of VBAX VBAX Grand Master Bob Phillips's Avatar
    Joined
    Apr 2005
    Posts
    25,453
    Location
    If it's a big file it will take a long time. Is it?
    ____________________________________________
    Nihil simul inventum est et perfectum

    Abusus non tollit usum

    Last night I dreamed of a small consolation enjoyed only by the blind: Nobody knows the trouble I've not seen!
    James Thurber

  3. #3
    Administrator
    VP-Knowledge Base
    VBAX Grand Master mdmackillop's Avatar
    Joined
    May 2004
    Location
    Scotland
    Posts
    14,489
    Location
    Try
    [VBA]
    ActiveWorkbook.SaveAs Filename:="E:\" & newFile

    [/VBA]
    MVP (Excel 2008-2010)

    Post a workbook with sample data and layout if you want a quicker solution.


    To help indent your macros try Smart Indent

    Please remember to mark threads 'Solved'

  4. #4
    VBAX Regular
    Joined
    Feb 2008
    Posts
    58
    Location
    the template is 145 kb...

  5. #5
    VBAX Regular jamward's Avatar
    Joined
    Feb 2008
    Location
    Grand Rapids, MI USA
    Posts
    26
    Location
    just a thought. i have had issues with run speeds when changing directories to mapped drives on a WAN or LAN. If E:\ drive is a mapped drive maybe hardcoding folder location would help?? i.e. ActiveWorkbook.SaveAs Filename:="\\FolderName\Sub-FolderName\etc.\etc." & newFileIf drive E:\ is hardware on your computer, all of this is irrelavent.

Posting Permissions

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