Disappearing pictures in VB generated Word document

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • TOPSie

    Disappearing pictures in VB generated Word document

    I used http://support.microsoft.com/kb/316383/en-us as the basis of
    some code to generate a Word document using VB code (.NET2005).
    In the code I have a loop which produces a table and in the merged
    left hand column I place a picture (looping round a directory full
    of ,jpg files - a table entry in the Word document for every picture).

    All works fine and the document looks fine on the screen and in Print
    Preview, but when I print only about 1 in 6 of the pictures appear on
    the paper (always the same ones when reprinted). The other tables have
    a blank left hand column.

    This is the code which creates the table:
    Dim oTable As Microsoft.Offic e.Interop.Word. Table
    RPath = RDirectory & RFileName
    oTable
    =oDoc.Tables.Ad d(oDoc.Bookmark s.Item("\endofd oc").Range, 4, 3)
    oTable.Cell(1, 2).Range.Text = "File"
    oTable.Cell(1, 3).Range.Text =
    RPath.Substring (InStrRev(RPath , "\"))
    oTable.Cell(2, 2).Range.Text = "Date"
    oTable.Cell(3, 2).Range.Text = "Location"
    oTable.Cell(4, 2).Range.Text = "Notes"
    oTable.Columns. Item(1).Width =
    oWord.InchesToP oints(2.5)
    'Change width of columns 1 & 2
    oTable.Columns. Item(2).Width =
    oWord.InchesToP oints(0.75)
    oTable.Columns. Item(3).Width =
    oWord.InchesToP oints(2.5)
    oTable.Columns. Item(1).Cells.M erge()
    With
    oTable.Cell(1,1 ).Range.InlineS hapes.AddPictur e(RPath)
    End With

    Anyone understand why the pictures don't print
Working...