Create an AutoTextEntry with it's value set to a document variable 
Author Message
 Create an AutoTextEntry with it's value set to a document variable

Using VBA, I need to create an AutoTextEntry and set it's value to a
Document variable which would be dynamicly changed during the life of the
document.

I tried the following in word:
I inserted a field in to the document using DOCVARIABLE field code and
passing the document variable name as the parameter. I also selected that
field in the document and created an AutoTextEntry for it. It worked fine
but I need to do this in vba.

In VBA, I tried using CreateAutoTextEntry method and created an
AutoTextEntry. I also tried adding a Field to the Fields collection which
added the field into the document (I don't really prefer this method,
because I don't need the field in the document at the time of AutoTextEntry
creation. I only want the user to insert the AutoTextEntry when he/she needs
it). But I couldn't assign the field to the AutoTextEntry's value, though I
was able to do this manually as I described above.
Please help.

Thanks,

-Harun



Sat, 23 Oct 2004 04:50:14 GMT  
 Create an AutoTextEntry with it's value set to a document variable
Hi Harun

You have to select the field in your code and then add the AutoText Entry
based on the selection.

Templates[TemplateName].AutoTextEntries.Add _
    Name:="whatever", Range:=Selection.Range

Regards

Dave


| Using VBA, I need to create an AutoTextEntry and set it's value to a
| Document variable which would be dynamicly changed during the life of the
| document.
|
| I tried the following in word:
| I inserted a field in to the document using DOCVARIABLE field code and
| passing the document variable name as the parameter. I also selected that
| field in the document and created an AutoTextEntry for it. It worked fine
| but I need to do this in vba.
|
| In VBA, I tried using CreateAutoTextEntry method and created an
| AutoTextEntry. I also tried adding a Field to the Fields collection which
| added the field into the document (I don't really prefer this method,
| because I don't need the field in the document at the time of
AutoTextEntry
| creation. I only want the user to insert the AutoTextEntry when he/she
needs
| it). But I couldn't assign the field to the AutoTextEntry's value, though
I
| was able to do this manually as I described above.
| Please help.
|
| Thanks,
|
| -Harun
|
|



Sat, 23 Oct 2004 05:03:06 GMT  
 Create an AutoTextEntry with it's value set to a document variable
Thanks for the trick Dave.
Is there a way to create the field in memory (not actually insert it in the
document) and just assign it to the AutoTextEntry. I will have variable
number AutoTextEntries created based on the document's charateristic when a
document is opened. I don't want to add bunch of fields to the document and
delete them after I create the AutoTextEntrys for them. It would be annoying
to the user. But if I don't have any other choice, I'll live with this.
Thanks, again.

-Harun


Quote:
> Hi Harun

> You have to select the field in your code and then add the AutoText Entry
> based on the selection.

> Templates[TemplateName].AutoTextEntries.Add _
>     Name:="whatever", Range:=Selection.Range

> Regards

> Dave



> | Using VBA, I need to create an AutoTextEntry and set it's value to a
> | Document variable which would be dynamicly changed during the life of
the
> | document.
> |
> | I tried the following in word:
> | I inserted a field in to the document using DOCVARIABLE field code and
> | passing the document variable name as the parameter. I also selected
that
> | field in the document and created an AutoTextEntry for it. It worked
fine
> | but I need to do this in vba.
> |
> | In VBA, I tried using CreateAutoTextEntry method and created an
> | AutoTextEntry. I also tried adding a Field to the Fields collection
which
> | added the field into the document (I don't really prefer this method,
> | because I don't need the field in the document at the time of
> AutoTextEntry
> | creation. I only want the user to insert the AutoTextEntry when he/she
> needs
> | it). But I couldn't assign the field to the AutoTextEntry's value,
though
> I
> | was able to do this manually as I described above.
> | Please help.
> |
> | Thanks,
> |
> | -Harun
> |
> |



Sat, 23 Oct 2004 05:32:01 GMT  
 Create an AutoTextEntry with it's value set to a document variable
Why not create them in the template at design time? That's how AutoText is
intended to be used. Then there would be no need to use code to create them
at all.

Regards

Dave


| Thanks for the trick Dave.
| Is there a way to create the field in memory (not actually insert it in
the
| document) and just assign it to the AutoTextEntry. I will have variable
| number AutoTextEntries created based on the document's charateristic when
a
| document is opened. I don't want to add bunch of fields to the document
and
| delete them after I create the AutoTextEntrys for them. It would be
annoying
| to the user. But if I don't have any other choice, I'll live with this.
| Thanks, again.
|
| -Harun
|


| > Hi Harun
| >
| > You have to select the field in your code and then add the AutoText
Entry
| > based on the selection.
| >
| > Templates[TemplateName].AutoTextEntries.Add _
| >     Name:="whatever", Range:=Selection.Range
| >
| > Regards
| >
| > Dave
| >
| >


| > | Using VBA, I need to create an AutoTextEntry and set it's value to a
| > | Document variable which would be dynamicly changed during the life of
| the
| > | document.
| > |
| > | I tried the following in word:
| > | I inserted a field in to the document using DOCVARIABLE field code and
| > | passing the document variable name as the parameter. I also selected
| that
| > | field in the document and created an AutoTextEntry for it. It worked
| fine
| > | but I need to do this in vba.
| > |
| > | In VBA, I tried using CreateAutoTextEntry method and created an
| > | AutoTextEntry. I also tried adding a Field to the Fields collection
| which
| > | added the field into the document (I don't really prefer this method,
| > | because I don't need the field in the document at the time of
| > AutoTextEntry
| > | creation. I only want the user to insert the AutoTextEntry when he/she
| > needs
| > | it). But I couldn't assign the field to the AutoTextEntry's value,
| though
| > I
| > | was able to do this manually as I described above.
| > | Please help.
| > |
| > | Thanks,
| > |
| > | -Harun
| > |
| > |
| >
| >
|
|



Sat, 23 Oct 2004 07:12:36 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. Document variable with value that changes throughout the document

2. Can't set default value creating Jet DB via ADO

3. Record Set Guru's - Can't Create Record Set error 429

4. Record Set Guru's - Can't Create Record Set error 429

5. Create a Variable from the value of another variable

6. Help changing an object's name via a variable's value

7. How do I place a value of variable within a document

8. Retrieving a single Excel value into a Word document variable

9. Persistence of Document Variables values

10. Setting document variables

11. Q: document.domain Cannot set its value

12. Q: document.domain Cannot set its value...

 

 
Powered by phpBB® Forum Software