VBA Help - Save as PDF, Save to Desktop (Any User), File Name

Zef05

New Member
Joined
Oct 21, 2016
Messages
10
Hi!

I am trying to create a sales form for my four-man team.
I have codes for saving the file as PDF, using a filename in a designated cell, but it only works on my computer.
I was wondering if there is a way to use the same file and just save it to their desktops.

Thank you!
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
Why does it require you to type a filename?
Rich (BB code):
ThisWorkbook.SaveAs CreateObject("WScript.Shell").specialfolders("Desktop") & "\" & Sheets("sheet1").Range("a1").Value
 
Last edited:
Upvote 0
Hi!

I am trying to create a sales form for my four-man team.
I have codes for saving the file as PDF, using a filename in a designated cell, but it only works on my computer.
I was wondering if there is a way to use the same file and just save it to their desktops.

Thank you!


Hi

I use the following in my code

username = Environ("Username")
"C:\Users" & username & "\...."

Works a treat off other peoples however one flaw is it has to be the same file name so to speak.
 
Upvote 0
Why does it require you to type a filename?
Rich (BB code):
ThisWorkbook.SaveAs CreateObject("WScript.Shell").specialfolders("Desktop") & "\" & Sheets("sheet1").Range("a1").Value


When I used this code, it says subscript out of range.
I am sorry, I just copy paste the codes. I really don't know what I'm doing.
I have no idea how VBA codes work. But thank you for replying and helping me out.

If it's not too much to ask, would it be possible for you to post the exact code I can paste into the VBA?

Thank you!
 
Upvote 0
You need to put the sheetname and cell reference in, what's the sheet name and address of the cell?
 
Upvote 0
Hi

I use the following in my code

username = Environ("Username")
"C:\Users" & username & "\...."

Works a treat off other peoples however one flaw is it has to be the same file name so to speak.

That doesn't work in a lot of cases. The desktop path isn't always the same as the username
 
Upvote 0

Forum statistics

Threads
1,223,903
Messages
6,175,287
Members
452,631
Latest member
a_potato

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