VBA For Excel (365), How To Print To PDF, While Scaling To Fit All ...

Tech CommunityHomeCommunity HubsCommunity Hubs
  • Community Hubs Home
  • Products
  • Special Topics
  • Video Hub
Close

Most Active Hubs

Microsoft 365 Microsoft Teams Windows Security, Compliance and Identity Outlook Planner Windows Server Azure Exchange Intune and Configuration Manager Content Management SQL Server Microsoft Viva Connect and learn from experts and peers Microsoft FastTrack Best practices and the latest news on Microsoft FastTrack Microsoft Copilot for Sales A role-based copilot designed for sellers

Most Active Hubs

Education Sector AI and Machine Learning ITOps Talk Microsoft Partner Community Microsoft Mechanics Healthcare and Life Sciences Public Sector Internet of Things (IoT) Driving Adoption Small and Medium Business Startups at Microsoft Azure Partner Community Expand your Azure partner-to-partner network Microsoft Tech Talks Bringing IT Pros together through In-Person & Virtual events MVP Award Program Find out more about the Microsoft MVP Award Program.

Video Hub

Azure Exchange Microsoft 365 Microsoft 365 Business Microsoft 365 Enterprise Microsoft Edge Microsoft Outlook Microsoft Teams Security SharePoint Windows Browse All Community HubsBlogsBlogsEventsEvents
  • Events Home
  • Microsoft Ignite
  • Microsoft Build
  • Community Events
Microsoft Learn Microsoft Learn
  • Home
  • Community
  • Blog
  • Azure
  • Dynamics 365
  • Microsoft 365
  • Security, Compliance & Identity
  • Power Platform
  • Github
  • Teams
  • .NET
LoungeLounge
  • 1.4M Members
  • 6,806 Online
  • 337K Discussions
Search cancel Turn on suggestions Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type. Showing results for  Show  only  | Search instead for  Did you mean:  Sign In Sign In cancel Turn on suggestions Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type. Showing results for  Show  only  | Search instead for  Did you mean:  SOLVED
  • Home
    • Home
    • Microsoft 365
    • Excel
    • VBA for Excel (365), how to print to PDF, while scaling to fit all columns to a single page wide?
    VBA for Excel (365), how to print to PDF, while scaling to fit all columns to a single page wide? Discussion Options cagross cagross Copper Contributor

    ‎Oct 10 2020 08:17 AM

    ‎Oct 10 2020 08:17 AM

    VBA for Excel (365), how to print to PDF, while scaling to fit all columns to a single page wide?

    Hello. Using VBA for Excel (Office365), how can I print an Excel worksheet to PDF, while scaling to fit all columns to a single page wide? In my VBA script, I have already set: `FitToPagesWide = 1`. Here is more information.

    For the past few years I've used Office 2013, and with it, a particular VBA for Excel script which would print a worksheet to PDF, while scaling to fit all columns to a single page wide. I recently updated to Office365 and the same VBA script is now printing to PDF, but not scaling to fit all columns to a single page wide. Any ideas why that is occurring and how to resolve it?

    See this Pastebin for my VBA function.

    Thanks in advance.

    View best response

    Labels:
    • Excel
    • Macros and VBA
    • Office 365
     30.2K Views 0 Likes  7 Replies Reply
    • All Discussions
    • Previous Discussion
    • Next Discussion
    7 Replies NikolinoDE NikolinoDE replied to cagross

    ‎Oct 10 2020 09:24 AM

    ‎Oct 10 2020 09:24 AM

    Betreff: VBA for Excel (365), how to print to PDF, while scaling to fit all columns to a single page

    @cagross

    As far as I had to learn here...

    (This information without guarantee, I would be happy to be instructed if it could work.MS changes, develops and refines its products so well and quickly that you can hardly keep up with them. They are that good! :).

    Click the Link for more info about this issue, Please:

    This feature is not available in Excel for the web.

    If you have the Excel desktop application, you can use the Open in Excel button to open the workbook and scale the worksheet to fit data on one page.

    Fit to one pageExcel for Microsoft 365 Excel for the web Excel 2019 Excel 2016 Excel 2013https://support.microsoft.com/en-us/office/fit-to-one-page-f3015be3-e007-4762-90a7-19ebc8052511?ui=e...

    Thank you for your understanding and patience

    Nikolino

    I know I don't know anything (Socrates)

    0 Likes Reply cagross cagross replied to NikolinoDE

    ‎Oct 10 2020 09:31 AM

    ‎Oct 10 2020 09:31 AM

    Betreff: VBA for Excel (365), how to print to PDF, while scaling to fit all columns to a single page

    @NikolinoDE Thanks for the reply. I had a look at that link. Unless I'm missing something though, it describes how to print using the GUI provided by the Excel application. I'm asking how to print using VBA for Excel. Did I miss that information somewhere in the link you provided?

    0 Likes Reply NikolinoDE NikolinoDE replied to cagross

    ‎Oct 10 2020 09:53 AM

    ‎Oct 10 2020 09:53 AM

    Betreff: VBA for Excel (365), how to print to PDF, while scaling to fit all columns to a single page

    @cagross

    All versions of Office 365 will allow execution and creation of Macros, it is only the free online version that will not.

    Mean with it, only MicrosoftOffice 365 (browser version) does not support VBA macros.

    Does Office 365 Online version supports VBA(visual basic for applications)?

    https://social.technet.microsoft.com/Forums/office/en-US/7c46823c-2581-47a6-baac-66fb99ac3ea8/does-o...

    Work with VBA macros in Excel for the webExcel for the webhttps://support.microsoft.com/en-us/office/work-with-vba-macros-in-excel-for-the-web-98784ad0-898c-4...Enable or disable macros in Office files

    https://support.microsoft.com/en-us/office/enable-or-disable-macros-in-office-files-12b036fd-d140-4e...

    VBA Macros in Excel (office 365)

    https://answers.microsoft.com/en-us/msoffice/forum/msoffice_excel-mso_other-mso_365hp/vba-macros-in-...

    I hope that with this information I was able to help you in any way.

    Thank you for your understanding and patience

    Nikolino

    I know I don't know anything (Socrates)

    0 Likes Reply cagross cagross replied to NikolinoDE

    ‎Oct 10 2020 09:56 AM

    ‎Oct 10 2020 09:56 AM

    Betreff: VBA for Excel (365), how to print to PDF, while scaling to fit all columns to a single page

    @NikolinoDE I appreciate the reply, but those links aren't giving me any helpful information for my question. I'm asking for specific help on why my VBA code isn't doing what I expect.

    0 Likes Reply NikolinoDE NikolinoDE replied to cagross

    ‎Oct 10 2020 10:21 AM

    ‎Oct 10 2020 10:21 AM

    Betreff: VBA for Excel (365), how to print to PDF, while scaling to fit all columns to a single page

    @cagross

    In order not to be misunderstood, the goal of some Excel users in the community is to provide help with projects by Excel users, or rather to provide food for thought.As part of this excellent forum, my aim is to give help to get help where I can and need it.That's why I try (like some others here) to help voluntarily as far as I can.

    ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _ VerzeichnisName & "\" & Name, Quality:= _ xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, _ OpenAfterPublish:=True With ActiveSheet.PageSetup .Zoom = False .Orientation = xlLandscape .FitToPagesWide = 1 .FitToPagesTall = 1 End With 'Check your code to see if you have used zoom correctly. 'Is just a suggestion doesn't have to be right ... 'because I know that I don't know anything.

    The only thing I can do for you is this VBA code.But since I don't have a 365 Office desktop version (like you, as far as I could see your written version) I can't help you any further.I think that one of Microsoft will take care of your question.I'm sure they will give you a specific or official answer.In the meantime, please be patient, we have weekend :)

    Sorry that I took your time and couldn't give you a quick solution.

    Wish you a nice day/night.

    Nikolino

    I know I don't know anything (Socrates)

    0 Likes Reply best response confirmed by cagross (Copper Contributor) cagross cagross replied to NikolinoDE

    ‎Dec 03 2020 07:30 AM

    ‎Dec 03 2020 07:30 AM

    Solution Betreff: VBA for Excel (365), how to print to PDF, while scaling to fit all columns to a single page

    @NikolinoDE Sorry for the late reply. Thanks for the help. I was able to resolve the issue in another MS forum (see here).

    0 Likes Reply NikolinoDE NikolinoDE replied to cagross

    ‎Dec 03 2020 09:13 AM

    ‎Dec 03 2020 09:13 AM

    Betreff: VBA for Excel (365), how to print to PDF, while scaling to fit all columns to a single page

    @cagross

    I am pleased that you were able to find a solution to your project.I wish you good luck with Excel.

    Thank you for your time and patience

    NikolinoI know I don't know anything (Socrates)

    0 Likes Reply 1 best response Accepted Solutions best response confirmed by cagross (Copper Contributor) cagross cagross replied to NikolinoDE

    ‎Dec 03 2020 07:30 AM

    ‎Dec 03 2020 07:30 AM

    Solution Betreff: VBA for Excel (365), how to print to PDF, while scaling to fit all columns to a single page

    @NikolinoDE Sorry for the late reply. Thanks for the help. I was able to resolve the issue in another MS forum (see here).

    View solution in original post

    0 Likes Reply

    Share

    • Share to LinkedIn
    • Share to Facebook
    • Share to Twitter
    • Share to Reddit
    • Share to Email
    Browse

    Từ khóa » Visual Basic Excel Print To Pdf