Is there a macro to print to pdf using excel mac (Microsoft 365)?

tonywatsonhelp

Well-known Member
Joined
Feb 24, 2014
Messages
3,033
Office Version
  1. 365
  2. 2019
  3. 2016
Platform
  1. Windows
Hi Everyone,
not sure if this can be done but I'm look for a macro to turn Sheet"Report" into a pdf and name it the name value in D4.
i need it to work on a mac and pc (or just mac)

please help if you can

Thanks

Tony
 

Excel Facts

Format cells as date
Select range and press Ctrl+Shift+3 to format cells as date. (Shift 3 is the # sign which sort of looks like a small calendar).

DanteAmor

Well-known Member
Joined
Dec 3, 2018
Messages
14,789
Office Version
  1. 2010
Platform
  1. Windows
Try this:

VBA Code:
Sub Macro2()
  Dim sName As String
  sName = ThisWorkbook.Path & "\" & Sheets("Report").Range("D4").Value & ".pdf"
  Sheets("Report").ExportAsFixedFormat xlTypePDF, sName, 0, True, False, , , False
End Sub

If you have problems, you could make a macro recording, save the sheet as pdf, stop the macro, the generated code paste it here to adapt the name.
 

RoryA

MrExcel MVP, Moderator
Joined
May 2, 2008
Messages
38,782
Office Version
  1. 365
  2. 2019
  3. 2016
  4. 2010
Platform
  1. Windows
  2. MacOS
You should use Application.Pathseparator rather than "\"
 

tonywatsonhelp

Well-known Member
Joined
Feb 24, 2014
Messages
3,033
Office Version
  1. 365
  2. 2019
  3. 2016
Platform
  1. Windows
Thanks guys but I've tried my pc version but it debugs out.
was wounding if anyone knew how to get a mac to do it but I'll play around with it for a while.
thanks
Tony
 
Master Excel Bundle

Excel contains over 450 functions, with more added every year. That’s a huge number, so where should you start? Right here with this bundle.

Forum statistics

Threads
1,164,021
Messages
5,834,992
Members
430,331
Latest member
Syed Yasir Hannan

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