How do I save to the desktop across OS's?

  • Thread starter Thread starter Greg Little
  • Start date Start date
G

Greg Little

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
 
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.
 
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top