M
Mojo
Hi All
Some of you have kindly assisted me in getting 'x' number of pictures into
'x' number of table cells in a Word document using VBA, but I seem to have
hit a brick wall when it comes to getting the top border line to appear on
my inserted pics.
Now as soon as I manually add a carriage return above the pictures my top
border appears perfectly, but my code won't let me add this carriage return
before the pic. When the pic gets inserted it automatically obliterates
anything that was already in the cell and I get a pic with no top border.
I've tried giving a top margin to each cell so that it forces the issue, but
it doesn't work. It looks like Word needs that carriage return prior to
inserting the pic.
My code is currently as follows:
For y = 0 To UBound(arrData, 2)
If Len(arrData(2, y)) > 0 Then ' check that a picture name exists
Set oPic =
oNewDoc.Tables(intTable).Rows.Add.Cells(2).Range.InlineShapes.AddPicture(arrData(2,
y), False, True)
With oPic
.Width = 200
.Height = 150
.Borders.OutsideLineStyle = wdLineStyleSingle
.Borders.OutsideLineWidth = wdLineWidth075pt
.Borders.OutsideColor = wdColorAutomatic
End With
End If
strText = arrData(1, y) & vbCrLf ' desc
If Len(arrData(3, y)) > 0 Then strText = strText & arrData(3, y) & vbCrLf
' comment
oNewDoc.Tables(intTable).Rows.Add.Cells(2).Range.Text = strText
Next
The above works fine I just need to get a carriage return (or anything!!!)
that gets my top border to appear. I've got the left, right and bottom
borders no problem :0)
Any ideas?
Some of you have kindly assisted me in getting 'x' number of pictures into
'x' number of table cells in a Word document using VBA, but I seem to have
hit a brick wall when it comes to getting the top border line to appear on
my inserted pics.
Now as soon as I manually add a carriage return above the pictures my top
border appears perfectly, but my code won't let me add this carriage return
before the pic. When the pic gets inserted it automatically obliterates
anything that was already in the cell and I get a pic with no top border.
I've tried giving a top margin to each cell so that it forces the issue, but
it doesn't work. It looks like Word needs that carriage return prior to
inserting the pic.
My code is currently as follows:
For y = 0 To UBound(arrData, 2)
If Len(arrData(2, y)) > 0 Then ' check that a picture name exists
Set oPic =
oNewDoc.Tables(intTable).Rows.Add.Cells(2).Range.InlineShapes.AddPicture(arrData(2,
y), False, True)
With oPic
.Width = 200
.Height = 150
.Borders.OutsideLineStyle = wdLineStyleSingle
.Borders.OutsideLineWidth = wdLineWidth075pt
.Borders.OutsideColor = wdColorAutomatic
End With
End If
strText = arrData(1, y) & vbCrLf ' desc
If Len(arrData(3, y)) > 0 Then strText = strText & arrData(3, y) & vbCrLf
' comment
oNewDoc.Tables(intTable).Rows.Add.Cells(2).Range.Text = strText
Next
The above works fine I just need to get a carriage return (or anything!!!)
that gets my top border to appear. I've got the left, right and bottom
borders no problem :0)
Any ideas?