+ Reply to Thread
Results 1 to 5 of 5

Excel exporting PDF with two periods in file name, i.e. ''xyz..pdf"

Hybrid View

  1. #1
    Registered User
    Join Date
    07-10-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    12

    Excel exporting PDF with two periods in file name, i.e. ''xyz..pdf"

    I am using the following code:

    
    Option Explicit
    
    Sub Export_STR_PDF()
    
    Sheets("Shore Tank Report").Select
    
    Dim name
    
    name = Cells(1, 1)
    
    With ActiveSheet.PageSetup
        .Zoom = False
        .FitToPagesWide = 1
        .FitToPagesTall = 1
        .CenterHorizontally = True
    End With
    
    Range("B1:O111").ExportAsFixedFormat Type:=xlTypePDF, _
    Filename:=Application.GetSaveAsFilename("C:\users\alrh\desktop\" & name), Quality:=xlQualityStandard, _
    IncludeDocProperties:=True, IgnorePrintAreas:=False, _
    OpenAfterPublish:=True
    
    End Sub
    to successfully export a sheet to PDF. However, it apperas to be adding one period to save as ''all files'' and then another to save as a pdf. I know this is a small issue, but it's irritating and I have programs that rely on uniform filenames to run.

    Any help is appreciated. Thanks!

  2. #2
    Forum Contributor
    Join Date
    03-14-2012
    Location
    location
    MS-Off Ver
    Excel 2007
    Posts
    170

    Re: Excel exporting PDF with two periods in file name, i.e. ''xyz..pdf"

    perhaps something like this
    '
    '
    Filename:=Application.GetSaveAsFilename("C:\users\alrh\desktop\" & name & ".pdf"), Quality:=xlQualityStandard, _
    '
    '
    blue

  3. #3
    Registered User
    Join Date
    07-10-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: Excel exporting PDF with two periods in file name, i.e. ''xyz..pdf"

    I tried that, and unfortunately that makes it not show a default save name at all. I think the problem then is the redundancy of

    
    Type:=xlTypePDF
    and

    
    & ".pdf"
    Is there any way to use what you wrote, but get rid of the "Type:=" etc?

  4. #4
    Forum Contributor
    Join Date
    03-14-2012
    Location
    location
    MS-Off Ver
    Excel 2007
    Posts
    170

    Re: Excel exporting PDF with two periods in file name, i.e. ''xyz..pdf"

    this is what I use and it works fain...
    Sub Button2_Click()
    Dim strPDF_File_Name As String
    FileName1 = InputBox("Please input filename", "Filename")
    'Sheets(Array("Sheet1", "Sheet2")).Select
     Range("B1:d5").ExportAsFixedFormat Type:=xlTypePDF, Filename:=ThisWorkbook.Path & "\" & FileName1 & ".pdf", Quality _
     :=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, _
     OpenAfterPublish:=True
    End Sub
    and see here an example
    http://msdn.microsoft.com/en-us/libr...ffice.14).aspx
    Last edited by blue.chio; 07-30-2013 at 10:22 AM. Reason: added link

  5. #5
    Registered User
    Join Date
    07-10-2013
    Location
    USA
    MS-Off Ver
    Excel 2010
    Posts
    12

    Re: Excel exporting PDF with two periods in file name, i.e. ''xyz..pdf"

    Yes, yours would work, but I want it to bring up the saveas dialog box with the filepath/filename default as I entered.

+ 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. Transfert cell values from file "A" to file "B" skipping columns in file "B".
    By Sentrosi in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-16-2009, 11:11 PM
  2. Exporting to txt file, how to insert a "Enter" between lines
    By fidller in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 07-17-2005, 01:05 AM
  3. [SOLVED] exporting excel to csv large fields save as "####"
    By zzapper in forum Excel General
    Replies: 6
    Last Post: 06-25-2005, 05:05 PM
  4. [SOLVED] File-Save is grayed out for periods of time in Excel 2003
    By Ned Grubb in forum Excel General
    Replies: 1
    Last Post: 06-14-2005, 05:05 PM
  5. Replies: 1
    Last Post: 06-13-2005, 08:05 PM

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