
How to insert paragraph between picture & text
Hi -
I'm creating a Word 2K doc from within a VB DLL. I grab a couple of
paragraphs of text from SQL Server, then insert text for a caption and
finally insert a picture. What I want next is a extra paragraph then to
insert text for the following paragraph. What I'm getting is the picture
(it's a tif file I'm inserting using an InlineShape) which is ever so
slightly narrower than the column with the first letter of the following
paragraph to the right of the picture, with the rest of that word and the
rest of the paragraph on the next line. In other words, no paragraph, no
matter what I do.
My code for this area is below. I've tried every possible combination of
inserting paragraphs, seemingly all for naught. Thanks for the help. Bill
Else
With myFormat
.InsertAfter ("Figure 1. " & Trim(MyRs(55).Value) & vbCrLf)
.Font.Bold = True
' .InsertParagraphAfter '11
End With
nCount = wdDoc.Paragraphs.Count
Set myFormat = wdDoc.Range( _
Start:=wdDoc.Paragraphs(nCount).Range.Start, _
End:=wdDoc.Paragraphs(nCount).Range.End - 1)
wdDoc.InlineShapes.AddPicture FileName:=FileName,
Range:=myFormat
myFormat.Collapse Direction:=wdCollapseEnd
myFormat.InsertParagraphAfter '12
bDidFigure = True
End If
End If
'# Add conclusions paragraph
nCount = wdDoc.Paragraphs.Count
Set myRange = wdDoc.Range(wdDoc.Paragraphs(nCount).Range.Start, _
wdDoc.Paragraphs(nCount).Range.End - 1)
With myRange
.Font.Name = "New Times Roman"
End With
If bDidFigure Then
myRange.Collapse Direction:=wdCollapseEnd
myRange.InsertAfter ("Conclusions: " & Trim(MyRs(48)))
myRange.InsertParagraphBefore
Else
myRange.InsertAfter ("Conclusions: " & Trim(MyRs(48)))
End If