Strange Print error with VBA created doc

H

hals_left

Hi This may or not be vba related.

Has anyone ever encountered a prioblem like this before, Or know a
solution

A table cell in a word doc contains multiple address lines, created
using the code below in a template.

The address loooks just fine in Word and even in print preview, but on
the actual paper on the first line appears. Also intermittent , works
ok on some printers.
Users have found a workaround, cut the address then paste it back
before printing.
Any thoughts ?

Thanks
hals_left

Set objRS = objConn.Execute(strSQL)
If Not objRS.EOF Then

strAddress= objRS("BusinessName")
strAdd1 = objRS("Add1")
strAdd2 = objRS("Add2")
strAdd3 = objRS("Add3")
strTown = objRS("TownCity")
strCountyLine = objRS("County") & vbTab & objRS("PostCode")

If strAdd1 <> "" Then strAddress = strAddress & vbCrLf &
strAdd1
If strAdd2 <> "" Then strAddress = strAddress & vbCrLf &
strAdd2
If strAdd3 <> "" Then strAddress = strAddress & vbCrLf &
strAdd3
If strTown <> "" Then strAddress = strAddress & vbCrLf &
strTown
strAddress = strAddress & vbCrLf & strCountyLine

ActiveDocument.Tables(2).Rows(1).Cells(1).Select
Selection.Text = strAddress
 
D

Doug Robbins - Word MVP

Nothing to do with the code I would think, but I would use

ActiveDocument.Tables(2).Cell(2,1).Range.Text=strAddress

--
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
 

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