Solved

MS Word VBA - Determining Ribbon State on Open Combined with Toggle Event

Posted on 2016-07-25
3
15 Views
Last Modified: 2016-09-14
I have the same issue as another question posted on this site.

I'm having the same issues as Mike235, whereas the calculation of the ActiveWindow.UsableHeight property does not update the value within the same subscript following a .ToggleRibbon event.  There really is quite a paucity of information relating to the .ToggleRibbon script in MS Word, and I've spent a good amount of time looking for a solution.

The basic idea is that the application will recognize the ribbon state (visible or minimized) when the document is opened, and either activate the toggle ribbon command, or do nothing (if the ribbon was already minimized).  Additionally, I would like to have a close event that restores the ribbon to it's original state when the application was opened (i.e. either maximized or minimized).

Very simple to explain, and it also seems like the above code *should* work, although as you've demonstrated, this isn't the case.

I've tried implementing the latter code provided by DrTribos, although this isn't restoring the application window state back to having the ribbon visible when the document is closed and the application is exited.  I've been experiencing these issues in both MS Word 2010 & 2013.

Any further insight would be much appreciated.
0
Comment
Question by:Mark Delorme
  • 2
3 Comments
 
LVL 17

Accepted Solution

by:
xtermie earned 500 total points (awarded by participants)
ID: 41765230
Please see attached script (VB) that checks if ribbon is visible and minimizes
Function xxx(Params)   
set application=getobject(,"word.application")
xxx= -2
On Error Resume Next
if Application.ActiveDocument.CommandBars("Ribbon").Height>100 then
application.ActiveWindow.ToggleRibbon
    end if
end function 
wscript.echo xxx(11)

Open in new window


To restore use the opposite check
Function yyy(Params)   
set application=getobject(,"word.application")
yyy= -2
On Error Resume Next
if Application.ActiveDocument.CommandBars("Ribbon").Height<100 then
application.ActiveWindow.ToggleRibbon
    end if
end function 

wscript.echo yyy(11)

Open in new window

0
 

Author Comment

by:Mark Delorme
ID: 41770770
@xtermie:  This code does not work unfortunately.  I've tried everything; I'm thinking that it might not be possible.
0
 
LVL 17

Expert Comment

by:xtermie
ID: 41797493
script and suggestions work
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

This is an Add-On procedure to be used in conjunction with the code provided in Reducing EE Email Clutter using Outlook (http://www.experts-exchange.com/Software/Office_Productivity/Groupware/Outlook/A_3146-Outlook-Processing-EE-emails-on-Receive.…
If you work with Word a lot, you probably use styles. If you use styles a lot, you've probably balled your fist more often than not when working with the ribbon. In Word 2007/2010, one of the things that I find missing when using styles is a quic…
This video shows the viewer how to set up and create Footnotes in their document. Click on the References tab: Select "Insert Footnote": Type in desired text:
This Experts Exchange video Micro Tutorial shows how to tell Microsoft Office that a word is NOT spelled correctly. Microsoft Office has a built-in, main dictionary that is shared by Office apps, including Excel, Outlook, PowerPoint, and Word. When …

747 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now