+ Reply to Thread
Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    02-08-2005
    Posts
    6

    Auto Saving a file in a macro to a shared drive

    Hi everyone,

    I am running a macro in a template file and want to save it to a specific directory with a filename located in cell b20. Below is what I have now. It does a copy and paste values then tries to save to a shared drive. The first time I set it up it saved just fine. But now every time it saves to "My Documents" on my hard drive. I am new to visual basic and have no idea what I need to do. Any help is greatly appreciated. Also, what is the X drive on my computer may be a Z drive on another. How do I make the shared drive path relative?

    Thanks in advance

    Code:
    Sub Auto_Open()
    '
    ' Auto_Open Macro
    '
    Range("A1:F48").Select
    Selection.Copy
    Selection.PasteSpecial Paste:=xlPasteValues, Operation:=xlNone, SkipBlanks _
    :=False, Transpose:=False
    Windows("JIF_Template_VCCE.xls").Activate
    Range("b20").Select
    ChDir "X:\F2\VCCE\JIFs\"
    fname = Application.ActiveCell
    ActiveWorkbook.SaveAs Filename:=fname
    End Sub

  2. #2
    Valued Forum Contributor
    Join Date
    12-10-2006
    Location
    Sydney
    MS-Off Ver
    2007
    Posts
    873
    Trying passing the entire UNC path not just the letter that it's been mapped to (i.e. X on your computer) to the ChDir varaible.

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.2.0