Guest User

Unpin all Taskbar and Start Menu Icons

a guest
Nov 17th, 2014
221
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Option Explicit
  2.  
  3. Const CSIDL_APPDATA = &H1A
  4.  
  5. Dim objShell
  6. Dim objFolder
  7. Dim objFolderItem
  8. Dim objVerb
  9. Dim objCurrentUserAppData
  10. Dim strCurrentUserAppData
  11. Set objShell = CreateObject("Shell.Application")
  12. Set objCurrentUserAppData = objShell.NameSpace(CSIDL_APPDATA)
  13. strCurrentUserAppData = objCurrentUserAppData.Self.Path
  14.  
  15.  
  16.  
  17. '===================''==================='
  18. ' - Remove All Taskbar Pinned Items -
  19. '===================''==================='
  20.  
  21. Set objFolder = objShell.Namespace(strCurrentUserAppData & "\Microsoft\Internet Explorer\Quick Launch\User Pinned\TaskBar")
  22. For Each objFolderItem in objFolder.Items
  23.   For Each objVerb in objFolderItem.Verbs
  24.     If Replace(objVerb.name, "&", "") = "Unpin from Taskbar" Then objVerb.DoIt
  25.   Next
  26. Next
  27.  
  28. '===================''==================='
  29. ' - Remove All Start Menu Pinned Items -
  30. '===================''==================='
  31.  
  32. Set objFolder = objShell.Namespace(strCurrentUserAppData & "\Microsoft\Internet Explorer\Quick Launch\User Pinned\StartMenu")
  33. For Each objFolderItem in objFolder.Items
  34.   For Each objVerb in objFolderItem.Verbs
  35.     If Replace(objVerb.name, "&", "") = "Unpin from Start Menu" Then objVerb.DoIt
  36.   Next
  37. Next
Advertisement
Add Comment
Please, Sign In to add comment