Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 575
Default 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   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 54
Default 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
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
EXCEL FILES SAVED TO DESKTOP WILL NOT OPEN FROM DESKTOP randy111 Excel Discussion (Misc queries) 3 January 13th 08 10:38 PM
Saving Excel Icon to Desktop Candy Excel Discussion (Misc queries) 1 January 6th 07 10:08 PM
Saving Vba Code Rick, United Kingdom Excel Discussion (Misc queries) 5 September 8th 05 08:51 PM
Saving a Workbook without code KimberlyC Excel Programming 1 August 21st 03 07:07 PM
code for saving Pier Excel Programming 2 July 29th 03 12:25 PM


All times are GMT +1. The time now is 01:46 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"