change the value of the component in Word Ribbon
-
Tuesday, May 22, 2012 1:11 PM
I have a component editbox and when I add a new value and have several windows open Word, it sets this value in all of them. How do I set only the active window?
ribbon.editbox.Text = "newValue";
All Replies
-
Tuesday, May 22, 2012 10:50 PM
Hi weisebrazil,
First, you need clarify your Word version.
Second, show me you snippet in order to let me understand what you said.
Best Regards,
T.X.
-
Wednesday, May 23, 2012 1:43 PMModerator
Hi weisebrazil
You need to initiate (at the very least) the Word application's DocumentChange event so that you can catch when focus moves from one window to another. You add-in needs to store what edit box values belong to which documents. When the DocumentChange event is triggered, look up the value for the document object. Invalidate the Ribbon control so that it can "get" the appropriate value for the document that has just gotten the focus.
Cindy Meister, VSTO/Word MVP
-
Wednesday, May 23, 2012 2:15 PM
My word version is 2007.
In each session open (file open) I can have a different user to connect to the server and synchronize the document. The application has the same concept as "google cloud connect", but with multiple configurations.
In my code:
ThisAddIn
MyRibbon rb;
void startup(...){rb = new MyRibbon();}
MyRibbon void btClick(){ OpenDialog od = new OpenDialog(); od.showDialog(); rb.editbox.Text = od.userbox.Text; }The problem is that I dont know how to fetch the value contained in the session.
If I two open word windows on each side, it changes in the global scope.
- Edited by weisebrazil Wednesday, May 23, 2012 2:16 PM
-
Monday, June 04, 2012 11:20 AMsomeone could show me how to do?
-
Monday, June 04, 2012 2:51 PM
the same topic:

