R
rocket0612
Hi, I have written a small macro that pulls data from excel to populat
a letter with data in word (eg name, address, and some selecte
paragraphs). here is an example of my code:
visual basi
code:--------------------------------------------------------------------------------wordarra
= Array(addressline1, addressline2, addressline3, addressline4
postcode, Policynumber, Yourref, ourref, date, salutation, para1
para2, para3, para4, signed, position)
wrd.Activedocument.Fields(1).Select
With wrd.Selection
.InsertAfter Text:=Addressee
End With
For wrdroutine = 0 To 15
wrd.Selection.NextField.Select
With wrd.Selection
.InsertAfter Text:=wordarray(wrdroutine)
End With
Next
End
--------------------------------------------------------------------------------
My problem is, sometimes para1 may not be applicable, and the same fo
the rest of the paragraphs. So I could have a letter that will hav
para2, para3 & para5. This will leave blank spaces were para1 & para
are. Is there a way so that if para = "" (in this case para1 & para4
then it will delete that line where that are supposed to be input an
the one below to bring the text up so there will not be 3 blank line
between the next paragraph entere don the letter?
I hope this makes sense!
many thank
a letter with data in word (eg name, address, and some selecte
paragraphs). here is an example of my code:
visual basi
code:--------------------------------------------------------------------------------wordarra
= Array(addressline1, addressline2, addressline3, addressline4
postcode, Policynumber, Yourref, ourref, date, salutation, para1
para2, para3, para4, signed, position)
wrd.Activedocument.Fields(1).Select
With wrd.Selection
.InsertAfter Text:=Addressee
End With
For wrdroutine = 0 To 15
wrd.Selection.NextField.Select
With wrd.Selection
.InsertAfter Text:=wordarray(wrdroutine)
End With
Next
End
--------------------------------------------------------------------------------
My problem is, sometimes para1 may not be applicable, and the same fo
the rest of the paragraphs. So I could have a letter that will hav
para2, para3 & para5. This will leave blank spaces were para1 & para
are. Is there a way so that if para = "" (in this case para1 & para4
then it will delete that line where that are supposed to be input an
the one below to bring the text up so there will not be 3 blank line
between the next paragraph entere don the letter?
I hope this makes sense!
many thank