Results 1 to 3 of 3

Thread: Controlling Standard menus in word via VB

  1. #1

    Thread Starter
    Junior Member
    Join Date
    May 2000
    Posts
    17

    Unhappy

    I'm trying to customize standard menus within Word that are on particular templates. I've read up and know how to apply the follwonig code to apply menu changes only to the active template, but I'm having diff getting my hands on the File, Edit and other standard menus.

    word.application.CustomizationContext = ActiveDocument.AttachedTemplate

    I've tried accessing the CommandBars collection.

    I'd like to have a File menu with limited items on it. Some standard and some custom.

    Please help soon.

    Mark

    [Edited by markhirt on 06-26-2000 at 02:27 PM]

  2. #2
    Fanatic Member RealisticGraphics's Avatar
    Join Date
    Jul 1999
    Location
    Arkansas
    Posts
    655
    Well, let's say you were going to add an item to the File menu. You would do something like this:
    Code:
    Dim RGOpen As CommandBarButton
    Set RGOpen = Application.CommandBars("File").Controls.Add(Type:=msoControlButton, Before:=3)
    With RGOpen
    .Caption = CustomCaption
    .OnAction = SubNameOfProcedure
    End With
    www.RealisticGraphics.net

    Running VS.Net Enterprise & VB 6

    Other Languages: JavaScript, VBScript, VBA, HTML, CSS, ASP, SQL, XML

    MSN Messenger: kmsheff

  3. #3
    Frenzied Member
    Join Date
    Jan 2000
    Location
    Bellevue, WA, USA
    Posts
    1,357

    A general answer...

    I don't know if this applies to your situation, but often times it is helpful to simply record a macro and then see what the code that the macro generated looks like. Just press record, do the actions that you want to perform programatically, then look at the code generated by the macro.

    Of course the macro often adds a bunch of code that you can remove, but it can often answer questions that are otherwise difficult to solve.

    I've done that with a few applications. Not sure if it would help you or not.
    ~seaweed

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