Home |
Search |
Today's Posts |
|
#1
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA code for: Saving to desktop?
My spreadsheet will be distributed to many different users.
I need code to force the saving of a file on the desktop of th computer using the xls. spreadsheet. Of course, the Desktop is under My Documents/[name of re user]/Desktop DOes anybody know how to code the path to always save on any computer' desktop, whether personal computer, networked, etc.??? (Basically, I have created a data file based on the user's entires i the main spreadsheet that needs to be saved to the desktop of th user's computer because that person has to attach that file and emai it back to me....and I want the file easy to find when they ar attaching it to an email -- Message posted from http://www.ExcelForum.com |
#2
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA code for: Saving to desktop?
This seems to work on my machine but might need some testing
Sub SaveToDesktop() Dim strPath As String strPath = Environ("HomeDrive") & Environ("HomePath") & "\Desktop\Test.xls" ActiveWorkbook.SaveAs strPath End Sub Then again, why don't you include the code to email the sheet back to you in the sheet you are distributing. If everyone is on Outlook it is not that difficult. Have a search on google under "sending email outlook" and you'll find some ways to do it. Robin Hammond www.enhanceddatasystems.com "jasonsweeney " wrote in message ... My spreadsheet will be distributed to many different users. I need code to force the saving of a file on the desktop of the computer using the xls. spreadsheet. Of course, the Desktop is under My Documents/[name of reg user]/Desktop DOes anybody know how to code the path to always save on any computer's desktop, whether personal computer, networked, etc.??? (Basically, I have created a data file based on the user's entires in the main spreadsheet that needs to be saved to the desktop of the user's computer because that person has to attach that file and email it back to me....and I want the file easy to find when they are attaching it to an email) --- Message posted from http://www.ExcelForum.com/ |
#3
Posted to microsoft.public.excel.programming
|
|||
|
|||
VBA code for: Saving to desktop?
Following is based on code posted in this newsgroup not so long ago
and works well for me: ActiveWorkbook.SaveAs _ Filename:=Environ("USERPROFILE") & "\Desktop\" & filename, _ FileFormat:=xlNormal |
Reply |
Thread Tools | Search this Thread |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
EXCEL FILES SAVED TO DESKTOP WILL NOT OPEN FROM DESKTOP | Excel Discussion (Misc queries) | |||
Saving Excel Icon to Desktop | Excel Discussion (Misc queries) | |||
Saving Vba Code | Excel Discussion (Misc queries) | |||
Saving a Workbook without code | Excel Programming | |||
code for saving | Excel Programming |