How to programatically create a shortcut using VB

  • Thread starter Thread starter Romolo
  • Start date Start date
R

Romolo

I'm trying to set up a simple task to install my EXCEL files into my friends'
sys. To do that, I basically need to create sortcuts into Desktop window. Can
I achieve that by using Visual Basic? Any reference?
Thanks in advance!
 
Romolo said:
I'm trying to set up a simple task to install my EXCEL files into my
friends'
sys. To do that, I basically need to create sortcuts into Desktop window.
Can
I achieve that by using Visual Basic? Any reference?
Thanks in advance!

The fastest way consists of you creating the shortcut
manually, then copying the .lnk file to your friend's PC.
A more time consuming method requires some code,
e.g. like so::
'Set ObjShell = CreateObject("WScript.Shell")
'strPath=ObjShell.SpecialFolders("Desktop")
'Set objShortcut =ObjShell.CreateShortcut(strPath & "\Explorer Test.lnk")
'
'objShortcut.TargetPath = "%systemroot%\explorer.exe"
'objShortcut.arguments="D:\"
'objShortcut.Description = "Explorer Test"
'objShortcut.HotKey = "Ctrl+Shift+N"
'objShortcut.Save

This is fully explained under the "CreateShortcut" method in
the help file "script56.chm", which you can download from
the Microsoft site.
 
Hi, Pegasus, thanks a lot for your suggestions.
And... happy Christmas holidays to everyone!
 
Grazie altretanto, e tanti auguri.

Romolo said:
Hi, Pegasus, thanks a lot for your suggestions.
And... happy Christmas holidays to everyone!
 

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