Print PDF using VBA on Mac without specifying path

Nicoaus

New Member
Joined
Aug 23, 2022
Messages
2
Office Version
  1. 365
Platform
  1. MacOS
Hey guys,
I'm trying to make a macro that can save a pdf from an active sheet to the desktop without me specifying the user. Is this possible? I'm asking as the file is going to be used by multiple people and I'll have to replicate the macro 10 times. So to avoid changing the code 100 times to specify the user, is there a way to avoid any access issues by not mentioning the user and somehow getting the document saved on desktop?

Kind Regards,
Nico
 

Excel Facts

Format cells as time
Select range and press Ctrl+Shift+2 to format cells as time. (Shift 2 is the @ sign).
You can use VBA to determine current file path using CURDIR and then manipulate the text string to whatever you want.
 
Upvote 0
you can find the desktop location of current user with this:

VBA Code:
Dim strPath As String
strPath = Environ("USERPROFILE") & "\Desktop\"
 
Upvote 0
When in Mac OS you can't use Windows file path separators \ you must use forward slashes / and also use complete file paths
 
Upvote 0

Forum statistics

Threads
1,214,947
Messages
6,122,413
Members
449,082
Latest member
tish101

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
Back
Top