Calculator on the Tool Bar

S

SGangs

How to add Calculator as an icon on the Tool Bar of MS Word 2003 for easy
access.

Thanks in advance..
 
A

alborg

Hi S:

Just place a module with a macro such as this-

Private Sub CommandButton2_Click()
Dim WshShell As Object
Set WshShell = CreateObject("Wscript.Shell")
WshShell.Run "Calc"
Set WshShell = Nothing
End Sub

You can also do other API callups, s.a.-

-- WshShell.Run "NotePad" (or "NotePad C:\MyTrains.txt" to bring up a file)
-- WshShell.Run "Explorer"

Cheers,
Al
 
J

Jay Freedman

VBA also has a Shell method that can launch executables without the
Wscript.Shell. It does require the full path to the executable file, though.
For the calculator, the macro would be

Sub RunCalc()
Shell "c:\windows\system32\calc.exe", vbNormalFocus
End Sub

Also note that if you want to put a button on a toolbar (rather than on a
userform), the first line should start with Sub (or Public Sub, but Public
is the default and can be left out) and not with Private. Procedures that
are marked Private won't appear in the list of macros in the Customize
dialog, which makes it hard to assign them to toolbar buttons.

--
Regards,
Jay Freedman
Microsoft Word MVP
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top