Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

creating or copying a shortcut to the desktop of an .mdb 1

Status
Not open for further replies.

Pampers

Technical User
Apr 7, 2004
1,300
AN
Hi everyone,
I'm trying to create (or copy) a shortcut to the desktop-folder of access-application. Can't get it done. Any suggestions?

Pampers [afro]
Keeping it simple can be complicated
 
Think I found something:

Code:
Dim strDesktop As String
Dim objShortcut As Object
Dim objShell As Object
Dim wshShell As Object

'Create Shell Application
Set objShell = CreateObject("Shell.Application")
Set wshShell = CreateObject("WScript.Shell")
strDesktop = wshShell.SpecialFolders("Desktop")
Set objShortcut = wshShell.CreateShortcut(strDesktop & "\user2.lnk")
objShortcut.TargetPath = "C:\Server\Ava2000v1.0.mdb"
objShortcut.IconLocation "C:\Server\Pictures\icon.ico "
objShortcut.Save

Set objShell = Nothing
Set wshShell = Nothing
Set objShortcut = Nothing

Pampers [afro]
Keeping it simple can be complicated
 
Sorry, little correction (in IconLocation:

Code:
Dim strDesktop As String
Dim objShortcut As Object
Dim objShell As Object
Dim wshShell As Object

'Create Shell Application
Set objShell = CreateObject("Shell.Application")
Set wshShell = CreateObject("WScript.Shell")
strDesktop = wshShell.SpecialFolders("Desktop")
Set objShortcut = wshShell.CreateShortcut(strDesktop & "\user2.lnk")
objShortcut.TargetPath = "C:\Server\Ava2000v1.0.mdb"
objShortcut.IconLocation = "C:\Server\Pictures\iSAS.ico"
objShortcut.Save

Set objShell = Nothing
Set wshShell = Nothing
Set objShortcut = Nothing

Pampers [afro]
Keeping it simple can be complicated
 
FYI you don't need the objShell object.
 
Hi PHV,
What would be an other way...

Pampers [afro]
Keeping it simple can be complicated
 
I meant this:
Code:
Dim strDesktop As String
Dim objShortcut As Object
[!][s]Dim objShell As Object[/s][/!]
Dim wshShell As Object

'Create Shell Application
[!][s]Set objShell = CreateObject("Shell.Application")[/s][/!]
Set wshShell = CreateObject("WScript.Shell")
strDesktop = wshShell.SpecialFolders("Desktop")
Set objShortcut = wshShell.CreateShortcut(strDesktop & "\user2.lnk")
objShortcut.TargetPath = "C:\Server\Ava2000v1.0.mdb"
objShortcut.IconLocation = "C:\Server\Pictures\iSAS.ico"
objShortcut.Save

[!][s]Set objShell = Nothing[/s][/!]
Set wshShell = Nothing
Set objShortcut = Nothing
 
Hi PHV,
I thought you had to create the Shell object first. But that is thus not the case. Thanx for the info.

Pampers [afro]
Keeping it simple can be complicated
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top