Re: Invalidate a 2007 ribbon control via 2003 VBA

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



Ed if the ribbon obect is declared as public

Public myRibbon as Ribbon

then I don't see why you couldn't call if from the UserForm button click
event.

Sub CallUF()
Dim oFrm as UserForm1
Set oFrm = New UserForm1
oFrm.Show vbModeless
End Sub


Sub Button_Click
myRibbon.InavlidateControl ("Control Whatever")
Unload Me
End Sub


Ed wrote:
I have created a fairly nice looking, and very effective, 2007
ribbon. It has lots of calls to my original 2003 project. (I
reference the 2003 project via Tools/References. This is really
sweet.)
Normally, I can get all the functionality I want because, if a
ribbon element (let's say a menu) needs to be reconfigured -- for
example a dynamic menu containing a list of documents created in the
2003 routine), I complete the macro that calls the 2003 project with
an 'invalidatecontrol' command. Thus:

Sub GoodStuff()
call vbOldProject.module3.runthismacro
myribbon.invalidatecontrol "mycontrol"
End Sub

The challenge: I am currently working with a command that
ultimately calls a 2003 userform. The form is displayed in the 2003
project in 'modeless' fashion. That way, I (and my users) can edit
text outside the form while the form is still displayed. One of the
buttons on the form, however, is used (occasionally) to generate a
list of terms that I want shown in a dynamic menu in 2007. (The list
of terms is saved out as a .txt file. I want that file read and
displayed by the dynamic 2007 menu when it is invalidated and
redrawn.)
However, because the form is modeless, the routine runs all the
way to the end, including running through the processing of the
"myribbon.invalidatecontrol" command found in the call from 2007 to
2003 (example above). So when the list of documents is generated and
control is returned to 2007, it is already passed the
"myribbon.invalidatecontrol" command.

Ideally, I need the Word2003 project itself to call the
'invalidatecontrol' command, but I cannot figure out how to get that
to happen. Can Word2003 vba call a Word2007 vba action?

--
Greg Maxey - Word MVP

My web site http://gregmaxey.mvps.org
Word MVP web site http://word.mvps.org



.


Quantcast