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

Did you know Excel offers Filter by Selection?
Add the AutoFilter icon to the Quick Access Toolbar. Select a cell containing Apple, click AutoFilter, and you will get all rows with Apple
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,577
Messages
6,173,164
Members
452,504
Latest member
frankkeith2233

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