Skip to main content

Notifications

Community site session details

Community site session details

Session Id : z2qZ1uBn8A+tscJwQPwVmt
Power Automate - Building Flows
Unanswered

Problem: Convert Excel macro-enabled XLSM file to PDF

Like (0) ShareShare
ReportReport
Posted on 18 Jan 2020 05:24:23 by 123

I have a Excel macro file (workbook) which requires to be uploaded to OneDrive for Business and converted to PDF. Trigger is When a file is created. Then using standard Convert File action (PDF format) and then Create File which does not give any error. However, the created PDF file has 0 bytes and does not open as a PDF in browser or Acrobat Reader. 

I have also tried to save the file as XLSX (non-macro) file, but same result. 

One reason for the problem may be that the file has multiple worksheets (about 15). I have defined a Print Area in the Excel. Also, I have a Name Range defined for the area I want to print. Not sure what will help.

  • YatinMumbai Profile Picture
    123 on 22 Jan 2020 at 07:35:38
    Re: Problem: Convert Excel macro-enabled XLSM file to PDF

    UPDATE: 

    After a of tinkering I found the issues that prevent Excel to PDF conversions (using OneDrive Convert File action). 

    1. Remove all of the the following - Macros, Modules, Buttons.
    2. Remove all Connections. In 2 worksheets I had a table linked to a SharePoint list causing fail.
    3. Both of the above can be done from VBA code (in Save As macro).
    4. Save the file as XLSX file. (FileFormat:=51)

    Issue still present:

    1. You cannot select a single worksheet to print.
    2. It is better to have created Print Area for each worksheet since all worksheets will printed to PDF.
    3. If your sheets are a mix of Print Area as portrait and landscape orientation, the conversion will have only the orientation of the first sheet. All other orientation settings will be ignored. If you use a third party PDF converter like Muhimbi, this is taken care of.

     

  • v-bacao-msft Profile Picture
    on 20 Jan 2020 at 01:37:22
    Re: Problem: Convert Excel macro-enabled XLSM file to PDF

     

    Hi @YatinMumbai ,

     

    Have you tried using Get file content action or Get file metadata to get the file size and File content?

     

    See if its file contents can be referenced normally and if the file size is as expected.

     

    In addition, you can create a simple Excel file to perform a similar test and see if such errors also exist. The purpose of this is to confirm whether this is related to the reason for the problem you mentioned.

     

    Best Regards,

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Understanding Microsoft Agents - Introductory Session

Confused about how agents work across the Microsoft ecosystem? Register today!

Markus Franz – Community Spotlight

We are honored to recognize Markus Franz as our April 2025 Community…

Kudos to the March Top 10 Community Stars!

Thanks for all your good work in the Community!

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 146,702 Most Valuable Professional

#2
RandyHayes Profile Picture

RandyHayes 76,287 Super User 2024 Season 1

#3
Pstork1 Profile Picture

Pstork1 66,015 Most Valuable Professional

Leaderboard
Loading started