VB Controlling/Disabling MS Word Menus

VB Controlling/Disabling MS Word Menus

Post by Kell » Thu, 22 Aug 2002 00:28:01



I'm automating Word from Visual Basic 6 and having trouble disabling
menus.  I can disable high-level menus (File, Edit, View,...) but
can't seem to disable the submenus.

This works:
  WordDoc.CommandBars("Menu Bar").Controls("&Edit").Enabled = False

These do not work:
  WordDoc.CommandBars("Menu Bar").Controls("&File").Controls("Save
&As...").Enabled = False

  WordDoc.CommandBars("&File").Controls("Save &As...").Enabled = False

  WordDoc.CommandBars(36).FindControl(Id:=748,
recursive:=True).Enabled = False

What am I doing wrong?

Kelly

 
 
 

VB Controlling/Disabling MS Word Menus

Post by Kell » Thu, 22 Aug 2002 21:40:55


More info:  When I try to disable the submenus from within Word's VB
Editor (rather than from my VB program,) I get similar results:  The
following command works on a manually-opened Word document but not on
the Word Document my VB program creates:

Word.ActiveDocument.CommandBars("Menu
Bar").Controls("&File").Controls("Save &As...").Enabled = False

Does this help?

Kelly


> I'm automating Word from Visual Basic 6 and having trouble disabling
> menus.  I can disable high-level menus (File, Edit, View,...) but
> can't seem to disable the submenus.

> This works:
>   WordDoc.CommandBars("Menu Bar").Controls("&Edit").Enabled = False

> These do not work:
>   WordDoc.CommandBars("Menu Bar").Controls("&File").Controls("Save
> &As...").Enabled = False

>   WordDoc.CommandBars("&File").Controls("Save &As...").Enabled = False

>   WordDoc.CommandBars(36).FindControl(Id:=748,
> recursive:=True).Enabled = False

> What am I doing wrong?

> Kelly


 
 
 

1. Replacing A Word With Picture In MS-Word Using VB !

Dear Friends
Hope you all doing great.

I have this MS-Word file where I have to insert lots of images at many
points again and again.
So I was thinking that is there any way that I can insert these
pictures at required points using VB.
I mean that first while creating the MS-Word file I write down the
name of the pic and afterwords using a VB application I can replace
that "word" i.e. name of the pic with the actual image.

I hope you got what I want.

So if you have any idea how I can do this please let me know.

Love
Lovely

==============================================

2. Keep mail on server with CE

3. MS Word extension (create a new menu item in popup at text caret)

4. Streamer

5. VB menu control in activex control ???

6. Retrieve RMS Key information at runtime (using Fortran)

7. Enable/disable word wrap in edit control like notepad

8. DALLAS,TX-OPPORTUNITY- ASTRA- QUICK TEST PRO GURU NEEDED

9. Text Box/Rich Edit Control Disabling Word Wrap

10. Using MS-Word thesaurus from VB

11. Freetext serch from VB in MS Word Documents/PDF Documents?

12. VB to MS Word Problem

13. How to show a print preview like MS Word in VB.