Insert textfile into formfield

M

Mark

I am using Office XP.

Can someone please assist me with some code which with a case statement as
below picksup a value from another formfield and selects the appropriate text
file which is an address and places it in a formfield wrapping round the rows
of text?

I have tried various suggestions but to no avail!

Sub CrimeNo()
Dim strDivision As String

strDivision = Left(ActiveDocument.FormFields("CrimeNo").Result, 2)

Select Case strDivision

Case "EA"

'Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldIncludeText, _
'Text:="H:\\Victims Code\\EA.txt", PreserveFormatting:=False

'ActiveDocument.FormFields("Address").Select _
'Selection.TypeText Text:="H:\\Victims Code\\EA.txt"

'ActiveDocument.FormFields("Address").Select _
'Selection.Range.Text , Type:=wdFieldIncludeText, _
'Text:="H:\\Victims Code\\EA.txt", PreserveFormatting:=False

Case Else

End Select

Thanks
 
C

Cindy M -WordMVP-

Hi Mark,

In order to insert a field you will need to remove the document protection,
first. After inserting the field, you reimplement the protection. The basic code
for that you'll find in the Forms section on my website.
I am using Office XP.

Can someone please assist me with some code which with a case statement as
below picksup a value from another formfield and selects the appropriate text
file which is an address and places it in a formfield wrapping round the rows
of text?

I have tried various suggestions but to no avail!

Sub CrimeNo()
Dim strDivision As String

strDivision = Left(ActiveDocument.FormFields("CrimeNo").Result, 2)

Select Case strDivision

Case "EA"

'Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldIncludeText, _
'Text:="H:\\Victims Code\\EA.txt", PreserveFormatting:=False

'ActiveDocument.FormFields("Address").Select _
'Selection.TypeText Text:="H:\\Victims Code\\EA.txt"

'ActiveDocument.FormFields("Address").Select _
'Selection.Range.Text , Type:=wdFieldIncludeText, _
'Text:="H:\\Victims Code\\EA.txt", PreserveFormatting:=False

Case Else

End Select

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 8 2004)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or reply
in the newsgroup and not by e-mail :)
 

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