' Macro created 05/09/98 by Doug Robbins to insert long string into
FormField
'
FillText = "Your long string"
LenFillText = Len(FillText)
FirstBit = Left(FillText, 255)
If LenFillText > 255 Then
SecondBit = Mid(FillText, 256, LenFillText - 255)
ActiveDocument.FormFields("Text1").Result = FirstBit
Selection.GoTo What:=wdGoToBookmark, Name:="Text1"
ActiveDocument.Unprotect
Selection.InsertAfter SecondBit
ActiveDocument.Protect Type:=wdAllowOnlyFormFields, NoReset:=True
Else
ActiveDocument.FormFields("Text1").Result = FillText
End If

Signature
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
> Hi!!
>
[quoted text clipped - 33 lines]
> defined as a range). Any idea of how to solve the problems with the code?
> Does the rest of the code for the macro look fine?
Ruth - 13 Jan 2008 01:30 GMT
Thanks for your help!!
I used your code but I still get a runtime error 438 "Object doesn't support
property or method". Just to make it clear the macro is programmed in EXCEL
and opens the word document from there. Any idea of why this error???
> ' Macro created 05/09/98 by Doug Robbins to insert long string into
> FormField
[quoted text clipped - 64 lines]
> > defined as a range). Any idea of how to solve the problems with the code?
> > Does the rest of the code for the macro look fine?
Helmut Weber - 13 Jan 2008 12:03 GMT
Hi Ruth,
have you declared rngx as Word.range ?
Otherwise it will be an Excel.range.
--
Greetings from Bavaria, Germany
Helmut Weber, MVP WordVBA
Vista Small Business, Office XP
Ruth - 13 Jan 2008 13:08 GMT
Well Helmut good question!!
I have defined it as usual
Dim rngx as Range
so, probably it is defined as an Excel range. How do I define it as a word
range? I tried with Dim rngx as Word.Range but it doesn't work at all ....
Thanks for your help!!
> Hi Ruth,
>
[quoted text clipped - 9 lines]
>
> Vista Small Business, Office XP
Helmut Weber - 13 Jan 2008 13:49 GMT
Hi Ruth,
>so, probably it is defined as an Excel range. How do I define it as a word
>range? I tried with Dim rngx as Word.Range but it doesn't work at all ....
it depends on the way you access Word.
see:
http://word.mvps.org/FAQs/InterDev/EarlyvsLateBinding.htm
in principle, once you have got a Word-object
dim WrdRange as <WordObject>.range
--
Greetings from Bavaria, Germany
Helmut Weber, MVP WordVBA
Vista Small Business, Office XP
Ruth - 14 Jan 2008 08:58 GMT
Good morning Helmut,
Thanks for your help. That was the problem. I changed that and it worked fine.
> Hi Ruth,
>
[quoted text clipped - 15 lines]
>
> Vista Small Business, Office XP