[RESOLVED] {Word} Run Toolbar buttons
This post has be corrected to explain the correct "howto"
First attempt at trying to create objects in Word that link to VBA Code.
I basically don't understand where Word Object events are exposed so I can write code for these events. (so far no events for objects appear in the VBA editor).
Using Office 97 (I know its old).
This is what I've done:
Quote:
A) Create the required VBA code.
a) Created a module in the VBA editor and added the procedures I want to execute.
b) Saved this module and exited the VBA editor.
B) Created a blank "Customized" toolbar in Word by:
a) Tools Menu
b) - Customize
c) - Tab Toolbars
d) - New
e) - Entered name and saved
f) -Right clicked toolbar and changed default name.
C) Add Buttons (Command) to the toolbar {This is wrong, see C1 below}
(Maybe these should be toolbar buttons, not command object
If so, where do I find them??)
a) Tools Menu
b) - Customize
c) - Tab Commands
d) From Categories List selected Control Toolbox
e) - From Command List drag Dropped Command Button onto Toolbar
C1) To Place a Button on toolbar which executes VBA Code (Macro)
when pushed.
(VBA Procedure must already exist -- at least as a stub)
a) Tools Menu
b) - Customize
c) - Tab Commands
d) From Categories List select "Macros"
e) - From Command List drag "Macro Name" onto Toolbar
This creates the button
f) - Right click button and then Edit Macro name to desired button name.
D) A VBA procedure (macro) can also be created to toggle the toolbar.
As in C1 drag the macro for toggling the toolbar to the menus.
It now becomes a menu choice.
D) Saved above as Normal.dot (or whatever template name you want)
and exit VBA Editor
Thanks
David
Re: {Word} Run Toolbar buttons
if you right click do you have a view code option?
Re: {Word} Run Toolbar buttons
Westconn1
Thanks for response. After sleeping on it last night, I figured it out this AM
how to execute the procedure (they call it a macro) as a toolbar button.
Original post was edited.
Still need to figure out how and where the other "Control Toolbox" objects
can be placed and where the event exists. so I can write code against an event.
Maybe this also in the form of macros??
=================
Normally would write a VB5/6 App and then access Excel, Word from there.
However, wanted to create a Normal.dot for my visually impaired mother with all
the things she needs, so I can scan in whatever, then load it to Word, so that I
don't have to make all kind of adjustments for her to read it.
Was working on having Word read the document for her, so that's why I needed the toolbar.
Works great except only M$ Sam voice is available in XP.
Now need to learn Windows installer so I can install M$ other voices since M$ only provides them in a MSM format.
Re: {Word} Run Toolbar buttons
Quote:
Maybe this also in the form of macros??
in vba a macro is a vb procedure
any event code for inseerted controls, would be on the code page of the controls parent i.e. worksheet or form, but assigned macros can be in any open document or template codepane or module
doing what you are, i believe, i would add a module to normal.dot specifically, then put all assigned macros in one place
you can call other procedure in same code pane or public procedures in modules from any event procedures
sorry i can not help you with the voice stuff, but a simple installation procedure might be to create a dummy vb6 project with all required references, compile to exe, create an setup package, then deploy, the required objects should then be available in the computer to other programs
Re: {Word} Run Toolbar buttons
You can manually add a button and assign code to it or you can create and addin code which will do everything that you wanted including creating the button on the toolbar.
Also what is M$? I am afraid i have never heard that name before.
Sid
Re: {Word} Run Toolbar buttons
Thanks for input both.
Will consider this thread closed.
Have several other questions re "Word" and linking speech.
so new thread(s) more appropriate.
David
Re: [RESOLVED] {Word} Run Toolbar buttons
Quote:
Also what is M$? I am afraid i have never heard that name before.
is that sarcasm i hear?
microsoft
Re: [RESOLVED] {Word} Run Toolbar buttons
Oh how stupid of me.... No Pete, it is not sarcasm. I genuinely never even thought in my remote dreams that it could be Microsoft... :D
I even searched Google for M$!!!!
Sid