How to hide ribbon in word 2007 programmaticlly?

K

Kaven

Hi all,

Does anybody know how to hide ribbon or menu bar in word 2007 using C++?(or
VBA).

I have a requirement that when using CHtmlView in MFC to open office
document, the ribbon or menu,toolbar must be hide to increase the viewing
area. for word 2003, the following code works well:

Dim iCounter As Integer
For iCounter = 1 To CommandBars.Count
Application.CommandBars(iCounter).Enabled = False
Next

But in word 2007,it don't work. Should notice that when drag and drop a word
document into IE for opening, there is no ribbon. But why I use CHtmlView or
IWebBrower2 to navigate a word document, the ribbon area exist?

Thank you for your help.
 
C

Cindy M.

Hi =?Utf-8?B?S2F2ZW4=?=,

The new Office interface was consciously designed to NOT allow the developer as
much freedom with which tools are provided to the user. You won't be able to
recover this realestate completely.

One possibility would be to define and include an XML part for the Ribbon in
the document's file structure. The Ribbon XML can set the ribbon to start from
scratch, which would make it "empty". But you can't get rid of the big, round
"Office" button that will contain a limited number of basic commands.

Beyond that, the object model provides ToggleRibbon method, which will cycle
between "collapsing" the ribbon to look like an old-style MenuBar and expanding
it again.
Does anybody know how to hide ribbon or menu bar in word 2007 using C++?(or
VBA).

I have a requirement that when using CHtmlView in MFC to open office
document, the ribbon or menu,toolbar must be hide to increase the viewing
area. for word 2003, the following code works well:

Dim iCounter As Integer
For iCounter = 1 To CommandBars.Count
Application.CommandBars(iCounter).Enabled = False
Next

But in word 2007,it don't work. Should notice that when drag and drop a word
document into IE for opening, there is no ribbon. But why I use CHtmlView or
IWebBrower2 to navigate a word document, the ribbon area exist?

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :)
 
K

kfengbest

Thank you Cindy. But neither of your solution could be accepted in our
software because they could hide the ribbon completely as you have already
indicated:(
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top