Environ UserProfile

Dryver14

Well-known Member
Joined
Mar 22, 2010
Messages
2,396
Hi

When I try to operate this line of code

.ActiveDocument.SaveAs2 Environ("UserProfile") & "\ThisPC\Desktop\Movie Report.docx"

I cant get it to go to desktop. It should be \desktop......I have tried putting \thisPC in to help the situation.

essentially it opens a save file dialog box in the onedrive folder and stops waiting for me to select a location.

I think part of the problem is that userprofile only identifies user.

I am sure I have seen somewhere that I can change this somewhere in the system and I would appreciate being advised through this procedure,
I have a concern that should I ever try to write code for someone else it would stall for them too.
 

Excel Facts

Why are there 1,048,576 rows in Excel?
The Excel team increased the size of the grid in 2007. There are 2^20 rows and 2^14 columns for a total of 17 billion cells.
Try:

.ActiveDocument.SaveAs2 "C:\Users\" & Environ("UserName") & "\Desktop\Movie Report.docx"
 
Upvote 0
I have tried allsorts even the full path without environ

.ActiveDocument.SaveAs2 "C:\user\owner\Desktop\Movie Report.docx"
 
Upvote 0

Forum statistics

Threads
1,226,116
Messages
6,189,054
Members
453,523
Latest member
Don Quixote

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