I'm going to write the steps down because I've done this before but couldn't remember how I did it! If you didn't have luck with that method, then try putting it in the MS Office folder and see how that works. I don't know if it only worked because I put it in the MS Office folder or if it would have worked just sitting in the Start Menu folder since I right-clicked on it and chose "Pin to Start". The Microsoft Office folder and the shortcut was there. Then I went into the Start Menu and opened up I ended up getting it to work by putting the shortcut inside the Microsoft Office folder that was in the Start Menu folder using the path C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Microsoft Office. I don't have the root folder and mine is Office 12 since I'm running an older version (2007). For one thing, my path to Excel.exe is different from yours. ObjFolderItem.I am glad you got it to work. Still, something worth playing around with.Īnd before you ask, the answer is yes: you can also unpin an item from the Start Menu by using a script: Set objShell = CreateObject(“Shell.Application”) Give this script a try, and you’ll see what we mean: Set objShell = CreateObject(“Shell.Application”) The same thing happens if you call the Delete method programmatically instead of automatically deleting the file, that same confirmation box appears. For example, if you right-click a file and choose Delete, a dialog box pops up asking if you want to send the file to the Recycle Bin. That’s because when you invoke a verb, that verb functions exactly the same as if you had chosen the item from the context menu. Set objFolderItem = objFolder.ParseName(“bob.vbs”)Īnd, yes, these verbs are pretty cool, although they aren’t as cool as you might expect. Set objFolder = objShell.Namespace(“C:\Documents and Settings\gstemp\Desktop\Stuff”) Ok, ok, how did we know the ampersand has to be there? Simple: we ran this script, which returns a list of verbs that can be applied to Calc.exe: Set objShell = CreateObject(“Shell.Application”) And that’s not a misprint in P&in to Start Menu the ampersand is part of the command name, and indicates the shortcut key for the item (in this case, the letter i).
HOW TO PIN A DOCUMENT TO START MENU WINDOWS
Verbs are items that appear on the context menu when you right-click the application icon in Windows Explorer.
But hey, it’s just one extra line of code, and the net result is the same: we get hooked up to C:\Windows\System32\Calc.exe.Īfter that we use the InvokeVerb method to pin the application to the Start Menu. Then, right-click or press-and-hold on the EXE file to open a contextual menu and click or tap on Pin to Start. Open File Explorer and navigate to the location where the app is installed or saved.
Why can’t we just bind directly to the file? Who knows that’s just the way the Shell object is designed. An alternative way to pin a program to the Start Menu is from the contextual menu of its executable file. We then use the ParseName method to bind to the actual executable file ( calc.exe). After creating an instance of the Shell object, we use the Namespace method to bind to the folder ( C:\Windows\System32) where Calculator resides. ObjFolderItem.InvokeVerb(“P&in to Start Menu”)Īs you can see, we use the Shell Application object in order to perform this task. Set objFolderItem = objFolder.ParseName(“calc.exe”) Set objFolder = objShell.Namespace(“C:\Windows\System32”) Here, for example, is a script that pins the Windows Calculator ( calc.exe) to the Start Menu: Set objShell = CreateObject(“Shell.Application”) Nothing wrong with that, of course, but if want to really be cool you can pin items to the Start Menu using a script. In Windows Explorer, you can pin an application to the Start Menu by right-clicking the application icon and then clicking Pin to Start Menu. In that case you can “pin” the item to the Start menu once pinned, the application will stay on the Start menu forever (or until you unpin it), even if you never use the application. However, there might be an application or two that you always want to appear on the Start menu even if you don’t use the program all that often. Most of the time this works out pretty good after all, the applications you use most often are probably the applications you use most often. Shortcuts that show you up when you click All Programs stay put, and don’t appear or disappear depending on use.) The less you use an application – well, use it or lose, huh? (Incidentally, this refers solely to the application shortcuts that appear when you first click the Start button. For those of you who haven’t bought Windows XP yet (hey, what’s the matter with you we Scripting Guys have families to feed!), by default XP’s Start Menu changes over time: the more you use an application, the more likely it is to appear on the Start Menu. Hey, Scripting Guy! Can I pin a file to the Start Menu by using a script?