PDA

View Full Version : Word VBA Button



JimVABeach
11-27-2008, 09:45 PM
Hello,
I have a general question about IE buttons and VBA. Can you add a button on to a Word toolbar that is linked to a VBA sub procedure and userform, not just a VBA macro? I can only add buttons that link a macro to a Word toolbar, Word ignores the Userform. :dunno

--Thanks Jim

Nelviticus
11-28-2008, 02:12 AM
Not sure what you mean by 'IE buttons' but if you want a Word toolbar button to launch a user form, just write a a sub that launches the form then link that sub to your button.

fumei
11-28-2008, 10:36 AM
Hi Jim. Nelviticus is right (and I also do not know what you mean by IE buttons).

"Can you add a button on to a Word toolbar that is linked to a VBA sub procedure and userform, not just a VBA macro? "

You have to understand that a "VBA macro" IS a VBA procedure. There is no difference. A button simply tells VBA to execute whatever procedure the button points to.

So a button that fires...Sub Whatever()
' do stuff
' do more stuff
End Sub


and a button that fires:Sub DisplayMyUserform()
Userform1.Show
End Sub

are not different (except of course for the instructions IN the procedure). The button points to a procedure, and fires it.

Macros ARE procedures.

JimVABeach
12-31-2008, 11:59 PM
IE Buttons (toolbar buttons) is what I meant. Internet Explorer buttons was inaccurate. I'll try your suggestion. Thank you.:banghead:

lucas
01-03-2009, 12:02 PM
Why use buttons? Create a new menu item (http://slucas.virtualave.net/Wink/CustomMenuItem.htm).

fumei
01-06-2009, 10:27 AM
Some people like buttons.

Some people like menu items.

Some people like keyboard shortcuts.

I use all three methods, depending on circumstances. However, basically, I am the last one. I like using the keyboard. That way I do not have to move my hand over to the mouse.