Print from VB6 to Word placing background image

0

I have to touch up something very old, I simply need to print on the screen the birthdays of employees with a balloon fund and those things, an image that occupies the entire fund (100%). In principle, the idea is just to send the file by mail. The limitation is that I must use Visual 6 and Word 2003. I was looking for information about Word 2003 objects and there are almost no more. In summary, I had a problem in my computer when referencing oficce 11.0, so I had to use the word as object. My current problem is that I am inserting an image (a gif) then assemble a table with as many rows as records, and then "only when the records are finished" on the last page .. I need to insert another image (another gif) that is a greeting. I loaded the background image into the template that word uses when opening the file. I do not know how to get me to print this last image at the bottom of the last page ... help please! Copy the code:

Private Sub Export ()

Dim oWord As Object 'Word.Application Dim oDoc As Object 'Word.Document Dim otable As Object Dim otable2 As Object

Dim iRow As Integer
Set oWord = CreateObject("Word.Application")
oWord.Options.ReplaceSelection = False

Set oDoc = oWord.Documents.Add("N:\APP\CUMPLES\IMAGENES\basecumple5.dot")

With oDoc.PageSetup
    .Orientation = wdOrientPortrait
    .PaperSize = wdPaperA4
    '.VerticalAlignment = wdAlignVerticalCenter
End With

With poOraDynaset
    oDoc.InlineShapes.AddPicture FileName:="N:\APP\CUMPLES\IMAGENES\Titulo_" & Format(CStr(.Fields("FECHA_NACIMIENTO")), "mm") & ".gif"
    Set otable = oDoc.Tables.Add(oDoc.Bookmarks("\endofdoc").Range, .RecordCount, 3)
    If Not .RecordCount = 0 Then .MoveFirst
    Do Until .EOF
        iRow = iRow + 1
        otable.Cell(iRow, 1).Range.Text = MyCapitalize(CStr(.Fields("NOMBRE_COMPLETO")))
        otable.Cell(iRow, 2).Range.Text = CStr(.Fields("SECTOR"))
        otable.Cell(iRow, 3).Range.Text = Format(CStr(.Fields("FECHA_NACIMIENTO")), "dd/mmm")
        .MoveNext
    Loop

End With

    Set otable2 = oDoc.Tables.Add(oDoc.Bookmarks("\endofdoc").Range, 5, 1)
    otable2.Cell(iRow + 1, 1).Range.Text = MyCapitalize(" ")
    iRow = iRow + 1
    otable2.Cell(iRow + 1, 1).Range.Text = MyCapitalize(" ")
    iRow = iRow + 1
    otable2.Cell(iRow + 1, 1).Range.Text = MyCapitalize(" ")
    iRow = iRow + 1
    otable2.Cell(iRow + 1, 1).Range.Text = MyCapitalize(" ")

On Local Error Resume Next
otable.Columns(1).Width = 200
otable.Columns(2).Width = 200
otable.Columns(3).Width = 50
otable.AutoFormat wdTableFormatGrid2, False, False, True, False, False, False, True, True, False
oDoc.SaveAs "c:\windows\escritorio\Cumpleanios_" & Me.cmbMes.Text
oWord.Visible = True

Set oWord = Nothing Set oDoc = Nothing Set otable = Nothing Set otable2 = Nothing

End Sub

    
asked by look68 07.03.2018 в 14:31
source

0 answers