Ureader.com  
Microsoft software help and Community
   home   |   control panel login   |   archive   |  
 
Word
application.errors
conversions
docmanagement
drawing.graphics
formatting.longdocs
international
internet.assistant
mail
mailmerge.fields
menustoolbars
newusers
numbering
oleinterop
pagelayout
printingfonts
setup.networking
spelling.grammar
tables
vba.addins
vba.beginners
vba.customization
vba.general
vba.userforms
web.authoring
word6-7macros
word97vba
  
 
date: Tue, 10 Jun 2008 00:54:56 -0700 (PDT),    group: microsoft.public.word.vba.beginners        back       


WORD how to vary a constant by program   
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.
date: Tue, 10 Jun 2008 00:54:56 -0700 (PDT)   author:   Le Nordiste

Re: WORD how to vary a constant by program   
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.
date: Tue, 10 Jun 2008 22:26:11 +1000   author:   Doug Robbins - Word MVP

Re: WORD how to vary a constant by program   
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.
date: Tue, 10 Jun 2008 22:32:25 -0700 (PDT)   author:   Le Nordiste

Re: WORD how to vary a constant by program   
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.
>
>
>
date: Wed, 11 Jun 2008 18:15:29 +1000   author:   Doug Robbins - Word MVP

Re: WORD how to vary a constant by program   
I wil try tonight, Doug.

Thanks
date: Wed, 11 Jun 2008 04:36:53 -0700 (PDT)   author:   Le Nordiste

Re: WORD how to vary a constant by program   
I tried and i succeed, after two or three trial.

Thanks -one more time Doug for your explanation
date: Wed, 11 Jun 2008 23:35:21 -0700 (PDT)   author:   Le Nordiste

Google
 
Web ureader.com


    COPYRIGHT 2007, YARDI TECHNOLOGY LIMITED, ALL RIGHT RESERVE  |   contact us