code to place shortcut on user's desktop or Start menu?

  • Thread starter Thread starter gils usenet acct
  • Start date Start date
G

gils usenet acct

Hi All,

I am seeking VBA terminology for the route to the pc's current user's
desktop or Start Menu. What can I insert below instead of "All Users"? I am
writing code to put a program shortcut on the user's desktop.

Dim strDefFilePath As String, strFileToCopy As String
Dim strSourcePath As String, strSourceFile As String
Dim objFSO As Object

strSourcePath = "c:\Patients\AMR\"
strFileToCopy = "Ten Second EMR 2.doc"
strDefFilePath = "c:\Documents and Settings\All Users\Start
Menu\Programs\"
strSourceFile = strSourcePath & strFileToCopy

Set objFSO = CreateObject("scripting.FileSystemObject")
objFSO.copyfile LCase(strSourceFile), LCase(strDefFilePath)
Set objFSO = Nothing

Kill "C:\Patients\AMR\Ten Second Medical Record 2.doc"

TIA,
:)
Gil
 
There are a couple of ways, easiest is probably to use ..

strDefFilePath = "c:\Documents and Settings\" & Environ("UserName") &
"\Start Menu\Programs\"
 

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