Mac VBA Save to PDF

bravia

New Member
Joined
Apr 2, 2020
Messages
6
Office Version
  1. 365
Platform
  1. MacOS
Hi all,

I'd been having great success in Office 365 the latest build running on Mac OS Catalina, (after granting permission) exporting PDFs by VBA using the following simple script.

VBA Code:
Sub exportPatch()

lr = Sheets("1.Patch").Range("A6000").End(xlUp).Row

 s = Worksheets("Setup").Range("C53")
    
Sheets("1.Patch").Range("A1:L" & lr).ExportAsFixedFormat Type:=xlTypePDF, FileName:=s, Quality:= _
  xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, _
  OpenAfterPublish:=False
End Sub

Now when I run the script it initiates with a dialog showing the correct number of pages exporting - however it sends it directly to the printer, and adds it to the default printer queue, despite having a path & filename to write to - which had been working for the last few days.

I use another VBA script to create 5 new sub directories within the root directory the excel file is saved in and that works as expected still - so I'm not sure if it is a permissions issue.

I realise VBA on Mac is hit & miss, but I was achieving the result I wanted every time for a number of days & nothing has changed since, I wonder if anyone can offer and suggestions? Perhaps another PDF writing script that doesn't use the printing infrastructure?

Thanks for reading!
 

Some videos you may like

Excel Facts

Who is Mr Spreadsheet?
Author John Walkenbach was Mr Spreadsheet until his retirement in June 2019.

Watch MrExcel Video

Forum statistics

Threads
1,128,107
Messages
5,628,731
Members
416,333
Latest member
Time2Learn

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top