Results 1 to 8 of 8

Thread: [RESOLVED] {Word} Run Toolbar buttons

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Jul 2001
    Location
    Tucson, AZ
    Posts
    2,166

    Resolved [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:

    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
    Last edited by dw85745; Jan 20th, 2011 at 11:20 AM. Reason: Added the correct "howto"

  2. #2
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: {Word} Run Toolbar buttons

    if you right click do you have a view code option?
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  3. #3

    Thread Starter
    PowerPoster
    Join Date
    Jul 2001
    Location
    Tucson, AZ
    Posts
    2,166

    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.
    Last edited by dw85745; Jan 20th, 2011 at 08:44 AM.

  4. #4
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: {Word} Run Toolbar buttons

    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
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  5. #5
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    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
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

  6. #6

    Thread Starter
    PowerPoster
    Join Date
    Jul 2001
    Location
    Tucson, AZ
    Posts
    2,166

    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

  7. #7
    PowerPoster
    Join Date
    Dec 2004
    Posts
    25,618

    Re: [RESOLVED] {Word} Run Toolbar buttons

    Also what is M$? I am afraid i have never heard that name before.
    is that sarcasm i hear?
    microsoft
    i do my best to test code works before i post it, but sometimes am unable to do so for some reason, and usually say so if this is the case.
    Note code snippets posted are just that and do not include error handling that is required in real world applications, but avoid On Error Resume Next

    dim all variables as required as often i have done so elsewhere in my code but only posted the relevant part

    come back and mark your original post as resolved if your problem is fixed
    pete

  8. #8
    Discovering Life Siddharth Rout's Avatar
    Join Date
    Feb 2005
    Location
    Mumbai, India
    Posts
    12,001

    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...

    I even searched Google for M$!!!!

    Sid
    A good exercise for the Heart is to bend down and help another up...
    Please Mark your Thread "Resolved", if the query is solved


    MyGear:
    ★ CPU ★ Ryzen 5 5800X
    ★ GPU ★ NVIDIA GeForce RTX 3080 TI Founder Edition
    ★ RAM ★ G. Skill Trident Z RGB 32GB 3600MHz
    ★ MB ★ ASUS TUF GAMING X570 (WI-FI) ATX Gaming
    ★ Storage ★ SSD SB-ROCKET-1TB + SEAGATE 2TB Barracuda IHD
    ★ Cooling ★ NOCTUA NH-D15 CHROMAX BLACK 140mm + 10 of Noctua NF-F12 PWM
    ★ PSU ★ ANTEC HCG-1000-EXTREME 1000 Watt 80 Plus Gold Fully Modular PSU
    ★ Case ★ LIAN LI PC-O11 DYNAMIC XL ROG (BLACK) (G99.O11DXL-X)
    ★ Monitor ★ LG Ultragear 27" 240Hz Gaming Monitor
    ★ Keyboard ★ TVS Electronics Gold Keyboard
    ★ Mouse ★ Logitech G502 Hero

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width