title: Need a VB script that put word excel powerpoint outlook and access office icons on users desktops
body: <p>am really new to this so please forgive the ignorance.  we have a load of XP machines with office 2003 professional installed.  we have a login script that places icons for WORD EXCEL POWERPOINT OUTLOOK AND ACCESS 2003 icons on the users desktops.  however some machines now have office 2010 installed instead of 2003 and I am not sure how to modify the existing script to take this into consideration and deliver the correct set of icons. </p>
  
  <p>the existing script for 2003 office only is</p>
  
  <hr>
  
  <pre><code>Set objShell = WScript.CreateObject("WScript.Shell")
  strDesktopFolder = objShell.SpecialFolders("Desktop")
  Set objShortCut = objShell.CreateShortcut(strDesktopFolder &amp; _ 
      "\Microsoft Word 2003.lnk")
  objShortCut.TargetPath = "C:\Program Files\Microsoft Office\Office11\winword.exe"
  objShortCut.Description = "Microsoft Word 2003"
  objShortCut.Save
  
  Set objShell = WScript.CreateObject("WScript.Shell")
  strDesktopFolder = objShell.SpecialFolders("Desktop")
  Set objShortCut = objShell.CreateShortcut(strDesktopFolder &amp; _
      "\Microsoft Excel 2003.lnk")
  objShortCut.TargetPath = "C:\Program Files\Microsoft Office\Office11\excel.exe"
  objShortCut.Description = "Microsoft Excel 2003"
  objShortCut.Save
  
  Set objShell = WScript.CreateObject("WScript.Shell")
  strDesktopFolder = objShell.SpecialFolders("Desktop")
  Set objShortCut = objShell.CreateShortcut(strDesktopFolder &amp; _
      "\Microsoft Powerpoint 2003.lnk")
  objShortCut.TargetPath = "C:\Program Files\Microsoft Office\Office11\powerpnt.exe"
  objShortCut.Description = "Microsoft Powerpoint 2003"
  objShortCut.Save
  
  Set objShell = WScript.CreateObject("WScript.Shell")
  strDesktopFolder = objShell.SpecialFolders("Desktop")
  Set objShortCut = objShell.CreateShortcut(strDesktopFolder &amp; _
      "\Microsoft Access 2003.lnk")
  objShortCut.TargetPath = "C:\Program Files\Microsoft Office\Office11\msaccess.exe"
  objShortCut.Description = "Microsoft Access 2003"
  objShortCut.Save
  
  Set objShell = WScript.CreateObject("WScript.Shell")
  strDesktopFolder = objShell.SpecialFolders("Desktop")
  Set objShortCut = objShell.CreateShortcut(strDesktopFolder &amp; _
      "\Microsoft Outlook 2003.lnk")
  objShortCut.TargetPath = "C:\Program Files\Microsoft Office\Office11\outlook.exe"
  objShortCut.Description = "Microsoft Outlook 2003"
  objShortCut.Save        
  </code></pre>
  
  <hr>
  
  <p>I have  copied the above code and amended the paths to reflect the version change of office to 2010 but this also puts invalid shortcuts on the users desktop for the missing version</p>
  
  <p>the code I have is</p>
  
  <hr>
  
  <p>'<strong><em>*</em>**<em>*</em>**<em>*</em>**<em>*</em>**<em>*</em>**<em>*</em>**<em>*</em>**</strong>
  '* starting point of office 2003 links *
  '<strong><em>*</em>**<em>*</em>**<em>*</em>**<em>*</em>**<em>*</em>**<em>*</em>**<em>*</em>**</strong></p>
  
  <pre><code>Set objShell = WScript.CreateObject("WScript.Shell")
  strDesktopFolder = objShell.SpecialFolders("Desktop")
  Set objShortCut = objShell.CreateShortcut(strDesktopFolder &amp; _ 
      "\Microsoft Word 2003.lnk")
  objShortCut.TargetPath = "C:\Program Files\Microsoft Office\Office11\winword.exe"
  objShortCut.Description = "Microsoft Word 2003"
  objShortCut.Save
  
  Set objShell = WScript.CreateObject("WScript.Shell")
  strDesktopFolder = objShell.SpecialFolders("Desktop")
  Set objShortCut = objShell.CreateShortcut(strDesktopFolder &amp; _
      "\Microsoft Excel 2003.lnk")
  objShortCut.TargetPath = "C:\Program Files\Microsoft Office\Office11\excel.exe"
  objShortCut.Description = "Microsoft Excel 2003"
  objShortCut.Save
  
  Set objShell = WScript.CreateObject("WScript.Shell")
  strDesktopFolder = objShell.SpecialFolders("Desktop")
  Set objShortCut = objShell.CreateShortcut(strDesktopFolder &amp; _
      "\Microsoft Powerpoint 2003.lnk")
  objShortCut.TargetPath = "C:\Program Files\Microsoft Office\Office11\powerpnt.exe"
  objShortCut.Description = "Microsoft Powerpoint 2003"
  objShortCut.Save
  
  Set objShell = WScript.CreateObject("WScript.Shell")
  strDesktopFolder = objShell.SpecialFolders("Desktop")
  Set objShortCut = objShell.CreateShortcut(strDesktopFolder &amp; _
      "\Microsoft Access 2003.lnk")
  objShortCut.TargetPath = "C:\Program Files\Microsoft Office\Office11\msaccess.exe"
  objShortCut.Description = "Microsoft Access 2003"
  objShortCut.Save
  
  Set objShell = WScript.CreateObject("WScript.Shell")
  strDesktopFolder = objShell.SpecialFolders("Desktop")
  Set objShortCut = objShell.CreateShortcut(strDesktopFolder &amp; _
      "\Microsoft Outlook 2003.lnk")
  objShortCut.TargetPath = "C:\Program Files\Microsoft Office\Office11\outlook.exe"
  objShortCut.Description = "Microsoft Outlook 2003"
  objShortCut.Save    
  </code></pre>
  
  <p>'<strong><em>*</em>**<em>*</em>**<em>*</em>**<em>*</em>**<em>*</em>**<em>*</em>**<em>*</em>**</strong>
  '* starting point of office 2010 links *
  '<strong><em>*</em>**<em>*</em>**<em>*</em>**<em>*</em>**<em>*</em>**<em>*</em>**<em>*</em>**</strong></p>
  
  <pre><code>Set objShell = WScript.CreateObject("WScript.Shell")
  strDesktopFolder = objShell.SpecialFolders("Desktop")
  Set objShortCut = objShell.CreateShortcut(strDesktopFolder &amp; _ 
      "\Microsoft Word 2010.lnk")
  objShortCut.TargetPath = "C:\Program Files\Microsoft Office\Office14\winword.exe"
  objShortCut.Description = "Microsoft Word 2010"
  objShortCut.Save
  
  Set objShell = WScript.CreateObject("WScript.Shell")
  strDesktopFolder = objShell.SpecialFolders("Desktop")
  Set objShortCut = objShell.CreateShortcut(strDesktopFolder &amp; _
      "\Microsoft Excel 2010.lnk")
  objShortCut.TargetPath = "C:\Program Files\Microsoft Office\Office14\excel.exe"
  objShortCut.Description = "Microsoft Excel 2010"
  objShortCut.Save
  
  Set objShell = WScript.CreateObject("WScript.Shell")
  strDesktopFolder = objShell.SpecialFolders("Desktop")
  Set objShortCut = objShell.CreateShortcut(strDesktopFolder &amp; _
      "\Microsoft Powerpoint 2010.lnk")
  objShortCut.TargetPath = "C:\Program Files\Microsoft Office\Office14\powerpnt.exe"
  objShortCut.Description = "Microsoft Powerpoint 2010"
  objShortCut.Save
  
  Set objShell = WScript.CreateObject("WScript.Shell")
  strDesktopFolder = objShell.SpecialFolders("Desktop")
  Set objShortCut = objShell.CreateShortcut(strDesktopFolder &amp; _
      "\Microsoft Access 2010.lnk")
  objShortCut.TargetPath = "C:\Program Files\Microsoft Office\Office14\msaccess.exe"
  objShortCut.Description = "Microsoft Access 2010"
  objShortCut.Save
  
  Set objShell = WScript.CreateObject("WScript.Shell")
  strDesktopFolder = objShell.SpecialFolders("Desktop")
  Set objShortCut = objShell.CreateShortcut(strDesktopFolder &amp; _
      "\Microsoft Outlook 2010.lnk")
  objShortCut.TargetPath = "C:\Program Files\Microsoft Office\Office14\outlook.exe"
  objShortCut.Description = "Microsoft Outlook 2010"
  objShortCut.Save
  </code></pre>
  
  <hr>
  
  <p>Please help</p>