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
 
"Romolo" <Romolo@discussions.microsoft.com> wrote in message
news:0E962C1F-FB5E-47C3-95D3-A59D2CCAF20B@microsoft.com...
> 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


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, Romolo


"Pegasus (MVP)" wrote:

>
> "Romolo" <Romolo@discussions.microsoft.com> wrote in message
> news:0E962C1F-FB5E-47C3-95D3-A59D2CCAF20B@microsoft.com...
> > 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

>
> 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.
>
>
>
 
Grazie altretanto, e tanti auguri.

"Romolo" <Romolo@discussions.microsoft.com> wrote in message
news:5302344F-1157-46A8-A085-E4AD03BE7407@microsoft.com...
> Hi, Pegasus, thanks a lot for your suggestions.
> And... happy Christmas holidays to everyone!
> --
> grazie, Romolo
>
>
> "Pegasus (MVP)" wrote:
>
>>
 
Back
Top