# Reference Windows Script Host Object Model



## si77 (Sep 15, 2005)

I have a simple macro that creates a shortcut onto my desktop, when launched from an Excel Workbook. It works fine as I have referenced my 'Windows Script Host Object Model'. However when sent to a colleague, it did not as they don't have this checked. I want to send this macro to several people without this problem. I'm sure there's a way to reference this from the actual script, but I'm unsure how.

Can anybody help?

Here's my code:

Private Sub Workbook_Open()
Dim WSHShell As New WSHShell
Dim oShellLink As WshShortcut
desktoppath = WSHShell.SpecialFolders("Desktop") & "\CoAcs Systems Liaison.lnk"
Set oShellLink = WSHShell.CreateShortcut(desktoppath)

With oShellLink
.TargetPath = "I:\Globcust\Corporate actions and proxy voting\Corporate Actions System Liaison\Tom\Systems Liaison WEB\Home Page\Corporate Action WEB.html"
.WindowStyle = 1
.IconLocation = "I:\Globcust\Corporate actions and proxy voting\Corporate Actions System Liaison\Tom\Systems Liaison WEB\Home Page\Corporate Action WEB.html, 0"
.Arguments = ""
.Save
End With
Set WSHShell = Nothing
Set oShellLink = Nothing
End Sub

Many thanks,
Simon


----------



## si77 (Sep 15, 2005)

NOT TO WORRY!

I solved the problem by creating a vbs script, simply really. Here's the code if you're insterested. I pasted into notepad and saved as Test.vbs.

set WshShell = WScript.CreateObject("WScript.Shell")
strDesktop = WshShell.SpecialFolders("Desktop")
set oShellLink = WshShell.CreateShortcut(strDesktop & "\CoAcs WEB Pages.lnk")
oShellLink.TargetPath = "I:\Globcust\Corporate actions and proxy voting\Corporate Actions System Liaison\Tom\Systems Liaison WEB\Home Page\Corporate Action WEB.html"
oShellLink.WindowStyle = 1
oShellLink.Hotkey = "CTRL+SHIFT+F"
oShellLink.IconLocation = "I:\Globcust\Corporate actions and proxy voting\Corporate Actions System Liaison\Tom\Systems Liaison WEB\Home Page\Corporate Action WEB.html, 0"
oShellLink.Description = "Shortcut Script"
oShellLink.WorkingDirectory = "I:\Globcust\Corporate actions and proxy voting\Corporate Actions System Liaison\Tom\Systems Liaison WEB\Home Page"
oShellLink.Save 
msgbox "Shortcut Created on Desktop"


----------

