How to insert paragraph between picture & text 
Author Message
 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



Tue, 28 May 2002 03:00:00 GMT  
 How to insert paragraph between picture & text
Thanks ibby, I've got it now. I had trouble selecting the InlineShape but
once I got that done right this provided the cure I needed.
Bill


Quote:
> Hi Bill,

> Try:

> Selection.TypeParagraph

> after inserting the picture.

> --
> Hope this helps.



Tue, 28 May 2002 03:00:00 GMT  
 How to insert paragraph between picture & text
Hi Bill,

Try:

Selection.TypeParagraph

after inserting the picture.

--
Hope this helps.

Please post any replies to the **newsgroup** so that others in the newsgroup
may contribute or benefit.


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



Wed, 29 May 2002 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Delete range of paragraphs based on start text of paragraphs

2. Text overlaying picture inserted by VBA code

3. Inserting Pictures as part of the text, Programmatically

4. Problem inserting picture in line with text

5. Insert Picture - behind text

6. Rich Text Box - Insert / Format of Picture

7. Blank space at beginning of paragraph when Text Interpretation is set to HTML Text

8. inserting a number tag in a particular paragraph

9. Align only last-inserted paragraph in footer

10. Inserting paragraph in the table using VB

11. Inserting a paragraph at end of document?

12. How to insert paragraph (\par RTF tag) using VBA

 

 
Powered by phpBB® Forum Software