How check whether autotext entrie exist

M

Marc Ruiz

Hi,

I'm using a form with textboxes. The content of the textboxes is
assigned to autotext entries. Now I want to check whether the Autotext
entrie already exist in Normal.dot and if it is not to create that
Autotext.

Maybe someone has a tip.
Thanks in advance,
Marc
 
D

Dave Lett

Hi Marc,

You can use something like the following (to create the autotext entry, I
have chosen to use the selected text; you might need something else):

Dim oEntry As AutoTextEntry
Dim bExists As Boolean
With NormalTemplate
For Each oEntry In .AutoTextEntries
If oEntry.Name = "Test" Then
bExists = True
Exit For
End If
Next oEntry
End With
If Not bExists Then
NormalTemplate.AutoTextEntries.Add Name:="Test", _
Range:=Selection.Range
End If

HTH
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top