+ Reply to Thread
Results 1 to 13 of 13

ExportAsFixedFormat without Select

Hybrid View

amartinez988 ExportAsFixedFormat without... 06-17-2019, 10:23 AM
dangelor Re: ExportAsFixedFormat... 06-17-2019, 01:03 PM
Fluff13 Re: ExportAsFixedFormat... 06-17-2019, 01:17 PM
dangelor Re: ExportAsFixedFormat... 06-17-2019, 01:21 PM
Fluff13 Re: ExportAsFixedFormat... 06-17-2019, 01:24 PM
amartinez988 Re: ExportAsFixedFormat... 06-17-2019, 01:51 PM
Fluff13 Re: ExportAsFixedFormat... 06-17-2019, 01:53 PM
Arkadi Re: ExportAsFixedFormat... 06-17-2019, 01:56 PM
shg Re: ExportAsFixedFormat... 06-17-2019, 01:58 PM
amartinez988 Re: ExportAsFixedFormat... 06-17-2019, 02:02 PM
Fluff13 Re: ExportAsFixedFormat... 06-17-2019, 02:05 PM
amartinez988 Re: ExportAsFixedFormat... 06-17-2019, 02:28 PM
Fluff13 Re: ExportAsFixedFormat... 06-17-2019, 02:30 PM
  1. #1
    Forum Contributor amartinez988's Avatar
    Join Date
    05-04-2015
    Location
    Miami
    MS-Off Ver
    Office 2010
    Posts
    183

    ExportAsFixedFormat without Select

    Hi,

    I'm trying to export 3 Excel tabs as PDF. Everything works fine if I use>

        Sheets(Array("REPORTING", "REPORTING 2", "REPORTING 3")).Select
        Sheets("REPORTING").Activate
        ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, fileName:= _
            "C:\Users\user\Desktop\1905 Sport-Holdings Reporting Template Current.pdf" _
            , Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
            :=False, OpenAfterPublish:=False
    But I don't really like using select in my code. So I was trying something like>
        Sheets(Array("REPORTING", "REPORTING 2", "REPORTING 3")).ExportAsFixedFormat Type:=xlTypePDF, fileName:= _
            "C:\Users\user\Desktop\1905 Sport-Holdings Reporting Template Current.pdf" _
            , Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
            :=False, OpenAfterPublish:=False
    To avoid the Select and ActiveSheet code, but that throws an error. Is there any way to accomplish this unifying the 3 lines of code in one or for this case it really has to be this way?

    Thanks
    1 Or 0, that is the question.

  2. #2
    Forum Expert dangelor's Avatar
    Join Date
    09-06-2011
    Location
    Indiana, USA
    MS-Off Ver
    MS365 V.2406
    Posts
    2,312

    Re: ExportAsFixedFormat without Select

    You could use...
        With Sheets(Array("REPORTING", "REPORTING 2", "REPORTING 3"))
            Sheets("REPORTING").ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
            "C:\Users\user\Desktop\1905 Sport-Holdings Reporting Template Current.pdf" _
            , Quality:=xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas _
            :=False, OpenAfterPublish:=False
        End With

  3. #3
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,791

    Re: ExportAsFixedFormat without Select

    @dangelor
    That will only create a pdf of the Reporting sheet.

  4. #4
    Forum Expert dangelor's Avatar
    Join Date
    09-06-2011
    Location
    Indiana, USA
    MS-Off Ver
    MS365 V.2406
    Posts
    2,312

    Re: ExportAsFixedFormat without Select

    Quote Originally Posted by Fluff13 View Post
    @dangelor
    That will only create a pdf of the Reporting sheet.
    I stand corrected - I had 3 sheets manually selected before I ran the code.
    Last edited by dangelor; 06-17-2019 at 01:28 PM. Reason: Correction

  5. #5
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,791

    Re: ExportAsFixedFormat without Select

    Where they all selected when you ran the code?

  6. #6
    Forum Contributor amartinez988's Avatar
    Join Date
    05-04-2015
    Location
    Miami
    MS-Off Ver
    Office 2010
    Posts
    183

    Re: ExportAsFixedFormat without Select

    Yes. I need to export all 3 sheet in one pdf document.

  7. #7
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,791

    Re: ExportAsFixedFormat without Select

    You can remove this line
    Sheets("REPORTING").Activate
    but I think that they need to be selected.

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

    Re: ExportAsFixedFormat without Select

    From all I've read, you do have to select the sheets you want to export.
    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.

  9. #9
    Forum Expert shg's Avatar
    Join Date
    06-20-2007
    Location
    The Great State of Texas
    MS-Off Ver
    2010, 2019
    Posts
    40,689

    Re: ExportAsFixedFormat without Select

    Ditto. I think it's somewhere between a failure of consistency and a bug.
    Entia non sunt multiplicanda sine necessitate

  10. #10
    Forum Contributor amartinez988's Avatar
    Join Date
    05-04-2015
    Location
    Miami
    MS-Off Ver
    Office 2010
    Posts
    183

    Re: ExportAsFixedFormat without Select

    Yes. I can't find any other way. Weird, usually that Select statement can be replaced by the action you want to do.

  11. #11
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,791

    Re: ExportAsFixedFormat without Select

    Unfortunately not with ExportAsFixedFormat.

    Not sure about xl 2010, but with 2013 it seems to set the print area based off the active sheet, so the other sheets are not printed correctly.

  12. #12
    Forum Contributor amartinez988's Avatar
    Join Date
    05-04-2015
    Location
    Miami
    MS-Off Ver
    Office 2010
    Posts
    183

    Re: ExportAsFixedFormat without Select

    Weird. Ok guy, thanks.

  13. #13
    Forum Guru
    Join Date
    09-10-2017
    Location
    Chippenham, England
    MS-Off Ver
    365
    Posts
    15,791

    Re: ExportAsFixedFormat without Select

    You're welcome & thanks for the feedback

+ 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. ExportAsFixedFormat - PDF file size won't reduce
    By Secondtries in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 07-23-2018, 03:10 PM
  2. Pages Resizing When Using ActiveSheet.ExportAsFixedFormat
    By PosseJohn in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 02-16-2016, 04:16 PM
  3. ExportAsFixedFormat Invalid Procedure Call
    By harold-sih in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 07-24-2015, 12:26 PM
  4. [SOLVED] Error Message with ExportAsFixedFormat
    By PaulMcCudden in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 06-25-2015, 10:39 AM
  5. ExportAsFixedFormat cuts off Rows and Columns
    By cool1_boy1 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 04-22-2015, 02:31 PM
  6. [SOLVED] ExportAsFixedFormat FileName problem
    By ikslohap in forum Excel Programming / VBA / Macros
    Replies: 7
    Last Post: 09-16-2012, 07:08 PM
  7. ExportAsFixedFormat misalignment of chart data
    By gsmitman in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 03-01-2010, 02:28 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