Re: Invalidate a 2007 ribbon control via 2003 VBA
- From: "Ed" <nospam@xxxxxxxxxx>
- Date: Sun, 4 Jan 2009 22:36:26 -0500
Greg,
Thanks for the kind thoughts. However, I am not looking for a
workaround so much as I would like to know if the question posed in the
original post is possible. (I have already programmed a nice workaround for
this situtation. It involves setting a value in the registry when the call
for the form originates from the W2007 module. When the 2003 module takes
over, it checks for the registry entry. If it sees that the call came from
W2007, it displays the form modally. I loose a teensy bit of functionality,
but don't have to duplicate the form in two places. I am trying to avoid
program bloat.) If over time you learn a technique for invalidating a 2007
ribbon via 2003 vba, I would certainly like to know about it. And if I
discover it elsewhere, I'll post it here. Thanks.
--Ed
"Greg Maxey" <gmaxey@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:%2377NTlrbJHA.4124@xxxxxxxxxxxxxxxxxxxxxxx
Ed,
Then can you have the form in both modules and then call the appropriate
one based on the version being used?
Ed wrote:
Greg,
I can move the form into the 2007 module, but then it won't be
available for my 2003 installations. And I really don't want to have
to create two separate versions of the program. I appreciate your
input on this.
"Ed" <nospam@xxxxxxxxxx> wrote in message
news:fk68l.3074$716.2134@xxxxxxxxxxxxxxx
Greg,
Thanks for the input. I had already tried that.
The ribbon is declared as Public in the 2007 module. While I am
in the 2003 module (and the button is on a form called up while I
am in the 2003 VBA module), 2003 just doesn't see any of the 2007
elements. When I compile the 2003 project with a reference to the
2007 module, the routine reports "Error: Sub or Function not
defined." When I try to run it, I get the same error.
--Ed
"Greg Maxey" wrote:
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
--
Greg Maxey - Word MVP
My web site http://gregmaxey.mvps.org
Word MVP web site http://word.mvps.org
.
- References:
- Invalidate a 2007 ribbon control via 2003 VBA
- From: Ed
- Re: Invalidate a 2007 ribbon control via 2003 VBA
- From: Greg Maxey
- Re: Invalidate a 2007 ribbon control via 2003 VBA
- From: Ed
- Re: Invalidate a 2007 ribbon control via 2003 VBA
- From: Ed
- Re: Invalidate a 2007 ribbon control via 2003 VBA
- From: Greg Maxey
- Invalidate a 2007 ribbon control via 2003 VBA
- Prev by Date: RE: what is the JOTO option?
- Next by Date: Re: place cursor at the previous position
- Previous by thread: Re: Invalidate a 2007 ribbon control via 2003 VBA
- Next by thread: Find addresses
- Index(es):