ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How do I save to the desktop across OS's? (https://www.excelbanter.com/excel-programming/318914-how-do-i-save-desktop-across-oss.html)

Greg Little

How do I save to the desktop across OS's?
 
I want to save a document under another name using VBA. How do I force
it to save to the desktop across OS's? Win 98, and ME don't have
users, W2k and XP do. Do I have to write a different version for the
various versions of Windows? TIA for the help.

Greg

AA2e72E

How do I save to the desktop across OS's?
 
If I understand you correctly, you want to know what the desktop path is:

Sub DeskTopPath()
Set objScr = CreateObject("WScript.Shell")
DeskTopPath = objScr.SpecialFolders("Desktop") & "\"
Set objScr = Nothing
MsgBox DeskTopPath
End Sub

Any document you save to the DeskTopPath appears as an icon on the desktop.
"Greg Little" wrote:

I want to save a document under another name using VBA. How do I force
it to save to the desktop across OS's? Win 98, and ME don't have
users, W2k and XP do. Do I have to write a different version for the
various versions of Windows? TIA for the help.

Greg


GysdeJongh

How do I save to the desktop across OS's?
 
Hi,
I use VBscript for this in w95 , w98 , Me .Must be possible in VBA :

Set MyShell = Wscript.CreateObject("WScript.Shell")
Set MyFile = CreateObject("Scripting.FileSystemObject")
strDesktop = MyShell.SpecialFolders("Desktop")
MyFile.DeleteFile strDesktop & "\TheFileYouWantToDelete"

hth
Gys


"Greg Little" wrote in message
...
I want to save a document under another name using VBA. How do I force
it to save to the desktop across OS's? Win 98, and ME don't have
users, W2k and XP do. Do I have to write a different version for the
various versions of Windows? TIA for the help.

Greg




All times are GMT +1. The time now is 10:28 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com