I have a script that someone wrote that's used to pin Office 2010 shortcuts to 
the taskbar. Some of my computers have Office 2007 and others have 2010. Can 
someone please show me how to make the script determine which version of Office 
is on the machine and pin the appropriate items to the taskbar?

On Error Resume Next

Const CSIDL_COMMON_PROGRAMS = &H17
Const CSIDL_PROGRAMS = &H2
Set objShell = CreateObject("Shell.Application")
Set objAllUsersProgramsFolder = objShell.NameSpace(CSIDL_COMMON_PROGRAMS)
strAllUsersProgramsPath = objAllUsersProgramsFolder.Self.Path

Set objACCFolder = objShell.Namespace(strAllUsersProgramsPath & "\Accessories")
Set objOFFFolder = objShell.Namespace(strAllUsersProgramsPath & "\Microsoft 
Office")
Set objRootFolder = objShell.Namespace(strAllUsersProgramsPath & "\")

Set objRootFolder2 = objRootFolder.ParseName("Windows Media Player.lnk")
Set colROOTVerbs2 = objRootFolder2.Verbs
For Each objVerb in colROOTVerbs2
    If Replace(objVerb.name, "&", "") = "Unpin this program from taskbar" Then 
objVerb.DoIt
Next

Set objOFFFolder1 = objOFFFolder.ParseName("Microsoft Outlook 2010.lnk")
Set colOFFVerbs1 = objOFFFolder1.Verbs
For Each objVerb in colOFFVerbs1
    If Replace(objVerb.name, "&", "") = "Pin to Taskbar" Then objVerb.DoIt
Next

Set objOFFFolder1 = objOFFFolder.ParseName("Microsoft Word 2010.lnk")
Set colOFFVerbs1 = objOFFFolder1.Verbs
For Each objVerb in colOFFVerbs1
    If Replace(objVerb.name, "&", "") = "Pin to Taskbar" Then objVerb.DoIt
Next

Set objOFFFolder1 = objOFFFolder.ParseName("Microsoft Excel 2010.lnk")
Set colOFFVerbs1 = objOFFFolder1.Verbs
For Each objVerb in colOFFVerbs1
    If Replace(objVerb.name, "&", "") = "Pin to Taskbar" Then objVerb.DoIt
Next


________________________________
John Marcum
Sr. Desktop Architect
Bradley Arant Boult Cummings LLP
________________________________


________________________________

Confidentiality Notice: This e-mail is from a law firm and may be protected by 
the attorney-client or work product privileges. If you have received this 
message in error, please notify the sender by replying to this e-mail and then 
delete it from your computer.

=====================
Is managing company email taking up way too much time? 
Let users manage archived email through Outlook and drastically
reduce email storage requirements. 

Download trial at http://www.gfi.com/mailarchiver/?adv=930&loc=1

Reply via email to