autotext entry - "string parameter too long"

K

Kirsten

Is there a character limit for passing autotext entries using VBA? I select
the text on the screen then assign it to a string. When I try to do
autotextentry.add using selection.range, it tells me the "string paramter is
too long". I know I can create them at any length (pages long) using the
menu dialog box, it's just the VBA equivalent I'm having trouble with. I've
googled but couldn't find any answers. Can someone help me?

Also, is there some way to simply access the AutoText dialog box using VBA?
Thanks!
-Kirsten
 
K

Kirsten

Someone told me the workaround for this but now I'm unable to find the post
to know who to thank. So to whoever you are, thank you. :)

Can anyone answer me one other question? I'd like to add this autotext as
rich text, but it appears I've only got the arguments for (name, range).
Any way I can 'force' it to make a rich text autotext entry?
Thanks again.
 
P

Peter Hewett

Hi

I've just created an AutoText entry of 10,000+ characters, no problem using
the following code:

Public Sub AutotextTest()
Dim tpAttached As Word.Template

Set tpAttached = ActiveDocument.AttachedTemplate
tpAttached.AutoTextEntries.Add "NewATE2", Selection.Range
End Sub

the autotext dialogs are:
Application.Dialogs(wdDialogCreateAutoText).Show
Application.Dialogs(wdDialogEditAutoText).Show

HTH + Cheers - Peter
 
P

Peter Hewett

Hi Kirsten

Autotext entries are always stored containing all information. It's when you
come to inserting the autotext entry you get to choose whether to insert it
with its original formatting or not:

tpAttached.AutoTextEntries("NewATE2").Insert _
Selection.Range, RichText:=False

HTH + Cheers - Peter
 
K

Kirsten

Thanks for the answers Pete! Weird, the long entries wouldn't work for me.
Hmmm.... I got it to work with the work-around, though. I'm in Word 2000.
Maybe we have a different version? <shrug> I may just go with the dialog
boxes. It's much easier. <g>
 
K

Kirsten

I was thinking about that on the way home last night, but my insert is
already setup as RichText:=True. So I'm baffled. It appears to be taking
on the formatting (heading) of whatever line I insert it on. I'm so
close..but I think I'll have to go with that big ol' clumsy dialog box they
provide for us. (I wish it didn't have all those other tabs on it.)

Appreciate all the help!
 

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