create shortcut with Mkdir

create shortcut with Mkdir

Post by shir » Sat, 19 Apr 2008 17:16:25


Hi all,
I can create a folder automatically from Access VBA
with MkDir statement.But how to create a shortcut
to fhe folder created using MkDir.I want to put the
shorcut on my dekstop or user dekstop.

Thank's

Rgds,

Shiro
 
 
 

create shortcut with Mkdir

Post by Graham Man » Thu, 24 Apr 2008 12:17:17

Hi Shiro

The following code should work for you:

Dim oShell As Object
Dim oShortcut As Object
Dim sDesktop As String
Set oShell = CreateObject("WScript.Shell")
With oShell
sDesktop = .SpecialFolders("Desktop")
Set oShortcut = .CreateShortcut(sDesktop & "\" & "Shortcut to MyFolder"
& ".lnk")
End With
With oShortcut
.TargetPath = "c:\MyFolder"
.Save
End With
Set oShortcut = Nothing
Set oShell = Nothing


--
Good Luck :-)

Graham Mandeno [Access MVP]
Auckland, New Zealand

 
 
 

create shortcut with Mkdir

Post by TWFsZG » Fri, 25 Apr 2008 02:48:01

I was about to post this same type of request. I was hoping there was a way
to do this via VBA. I used this code in my application and it worked
perfectly! Thanks a million! MVPs are the best!!!

Maldo