Hi, In a .doc i have à UserForm, with some TextBoxes and other controls too. I want to populate the TextBoxes with permanent text, so that why i store this "permanent" text in a constant. But from time to time it is necessary to vary the "permanent text". How i can do this thing : Store permanent text, in order there are usable at each opening of the file, and how to be able to modify this pseudo constant string. Thanks by anticipation.
Store the text in document variables and have code in the userform activate event to set the .Text property of the controls to the .Value of the document variables and use code in a command button click event to update the .Values of the variables with the .Text of the relevant controls. To store something in a document variable, use ActiveDocument.Variables("varname").Value = somecontrol.Text you reverse the statement to retrieve the data from the variable somecontrol.Text = ActiveDocument.Variables("varname").Value If you want to display the value assigned to the variable in the document, use a DOCVARIABLE field. -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP "Le Nordiste" wrote in message news:639705a5-ee96-4e0b-af28-03802174564c@34g2000hsh.googlegroups.com... Hi, In a .doc i have à UserForm, with some TextBoxes and other controls too. I want to populate the TextBoxes with permanent text, so that why i store this "permanent" text in a constant. But from time to time it is necessary to vary the "permanent text". How i can do this thing : Store permanent text, in order there are usable at each opening of the file, and how to be able to modify this pseudo constant string. Thanks by anticipation.
Thanks Doug, Very good : i did not know the "ActiveDocumentVariables" it look as a versatile solution for some problems. But one more question, i did n't find how to save "Act_Doc_Variables("tata") in order to retrieve its new entered value at the next opening of the .doc. In other word my search is : I want to enter a "quasi-constant"value in a someControl.text and to automatically save it when i close the document - or at any event before closing, in order to retrieve the later entered value of the "quasiconstant" Here in Paris (France) the weather is fine. Thanks in anticipation.
You do not have to specifically save the variables. If you use code to set the values of the variables, those values will be saved in variables in the document when the document is saved. -- Hope this helps. Please reply to the newsgroup unless you wish to avail yourself of my services on a paid consulting basis. Doug Robbins - Word MVP "Le Nordiste" wrote in message news:5ee3ccc2-0ba1-40a2-a73b-1913b264fbec@y21g2000hsf.googlegroups.com... > Thanks Doug, > > Very good : i did not know the "ActiveDocumentVariables" it look as a > versatile solution for some problems. > > But one more question, i did n't find how to save > "Act_Doc_Variables("tata") in order to retrieve its new entered value > at the next opening of the .doc. > > In other word my search is : > I want to enter a "quasi-constant"value in a someControl.text and to > automatically save it when i close the document - or at any event > before closing, in order to retrieve the later entered value of the > "quasiconstant" > > > Here in Paris (France) the weather is fine. > > > Thanks in anticipation. > > >
I wil try tonight, Doug. Thanks
I tried and i succeed, after two or three trial. Thanks -one more time Doug for your explanation