View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
michelle michelle is offline
external usenet poster
 
Posts: 310
Default copy shortcut to desktop

Hi!

I'm new to excel but kinda familiar with VBA for Access. I would like to
copy stored shortcuts(.lnk) to the users desktop. I have the following code.
I was trying the FileCopy but I'm pretty sure I should be using CopyFile.
What do I need to make the FileSystemObject work?

Private Sub cmdCreateDesktopShortcut_Click()

'Dim FSO As FileSystemObject
Dim strUserDesktop
Dim strDrive As String
Dim strTempPath As String
Dim strSrcePath As String

'Set FSO = New FileSystemObject

'Set up Source string

strSrcePath = "bwes.net\Barberton file
shares\DocControlPLM\BatchLoadFiles\ScriptsAndZips \Shortcuts\Consolidated -
Approve.lnk"

'Set up Destination string

strDrive = "D:"
strTempPath = "\Documents and Settings\" & Environ("USERNAME") & "\Desktop\"

strUserDesktop = Dir(strDrive & strTempPath)

Kill strUserDesktop

FileCopy strSrcePath, strUserDesktop

End Sub