+ Reply to Thread
Results 1 to 5 of 5

Save Location

Hybrid View

  1. #1
    Registered User
    Join Date
    10-18-2010
    Location
    NJ
    MS-Off Ver
    Excel 2007
    Posts
    73

    Save Location

    The following is part of code that I'm using to turn an Excel worksheet into a PDF and then email it. Right now, it saves the PDF to my desktop. I can get it to save it to my C drive by simply replacing "Desktop" with "C:". However, I am unable to get it to save to a network drive such as "I:\Archive". When I use the I drive as a path, the rest of the macro works fine but the PDF doesn't save anywhere.

    Any idea what I'm doing wrong?

    Thanks,
    Steve

     ' Define PDF filename
      Title = "" & Range("X2").Value
      PdfFile = CreateObject("WScript.Shell").SpecialFolders("Desktop") & "\" & Title & ".pdf"
     
      ' Export activesheet as PDF
      With ActiveSheet
        .ExportAsFixedFormat Type:=xlTypePDF, Filename:=PdfFile, Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, OpenAfterPublish:=False
      End With

  2. #2
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Save Location

    pdffile just needs to be a string I believe... untested but try:
    PdfFile = "C:\" & Title & ".pdf"
    tested now, should work fine.
    Last edited by Arkadi; 03-18-2015 at 11:25 AM.
    Please help by:

    Marking threads as closed once your issue is resolved. How? The Thread Tools at the top
    Any reputation (*) points appreciated. Not just by me, but by all those helping, so if you found someone's input useful, please take a second to click the * at the bottom left to let them know

    There are 10 kinds of people in this world... those who understand binary, and those who don't.

  3. #3
    Registered User
    Join Date
    10-18-2010
    Location
    NJ
    MS-Off Ver
    Excel 2007
    Posts
    73

    Re: Save Location

    Quote Originally Posted by Arkadi View Post
    pdffile just needs to be a string I believe... untested but try:
    PdfFile = "C:\" & Title & ".pdf"
    tested now, should work fine.
    Thanks - that did the trick. I appreciate your help!

  4. #4
    Forum Expert daffodil11's Avatar
    Join Date
    07-11-2013
    Location
    Phoenixville, PA
    MS-Off Ver
    MS Office 2016
    Posts
    4,465

    Re: Save Location

    When you say replace Desktop with filepath, you do mean replace the whole preceding line, correct?

    This went to my network share just fine.

    Sub TestExport()
    
    PdfFile = "S:\Network_Share\Unicorns\Secret_Files\Test\bills.pdf"
    
     With ActiveSheet
        .ExportAsFixedFormat Type:=xlTypePDF, Filename:=PdfFile, _
                             Quality:=xlQualityStandard, IncludeDocProperties:=True, _
                             IgnorePrintAreas:=False, OpenAfterPublish:=False
      End With
    
    End Sub
    Make Mom proud: Add to my reputation if I helped out!

    Make the Moderators happy: Mark the Thread as Solved if your question was answered!

  5. #5
    Forum Expert Arkadi's Avatar
    Join Date
    02-13-2014
    Location
    Smiths Falls, Ontario, Canada
    MS-Off Ver
    Office 365
    Posts
    5,059

    Re: Save Location

    Great Steve! Thanks for the rep

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Macro to Auto save a backup copy in a seperate location OR save file with a pop up
    By kdsanderson30 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-12-2014, 12:38 PM
  2. [SOLVED] [Help]macro to open file browser, to select a location, and save the location to a cell
    By zhuleijia in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 04-06-2013, 09:56 AM
  3. Macro with cell reference as a name, but prompt for save location and save as csv
    By tomham in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 09-15-2012, 06:21 PM
  4. New save location
    By Richard1939 in forum Excel General
    Replies: 0
    Last Post: 08-02-2012, 08:22 AM
  5. Replies: 1
    Last Post: 07-24-2012, 09:53 AM

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