Insert TIFF formatted file in MS WORDS using VB6

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • lenniekuah
    New Member
    • Oct 2006
    • 126

    #1

    Insert TIFF formatted file in MS WORDS using VB6

    I have written a VB6 program extracting Customers Name and address from a table to incorporate it into a letter and output it to MS WORDS. At the bottom of the letter I tried to insert a digitised signature TIFF formatted file. Instead of the signature appearing on each letter generated by WORDS, all the signatures congregated at the last Letter. Being new to VB6 and just don't know what went wrong

    Here are sample of the script that insert the TIFF signature file into WORDS.

    Private Function FPrintSignature (ByVal iClientId As Long, iWord As Word.Applicatio n, iDoc As Word.Document)

    'vbcity version
    Dim objPic As InlineShape
    Dim objPicShape As Word.Shape

    Dim strSql As String
    Dim strSignPath As String

    strSql = "Select * from Signature where ClientId = " & iClientId
    adoRstSign.Open strSql, adoConn, adOpenKeyset
    With adoRstSign
    If Not .EOF Then
    strSignPath = .Fields("SignPa th")

    Set objPic = iDoc.InlineShap es.AddPicture(s trSignPath, False, True, iWord.Selection .Range)
    Set objPicShape = objPic.ConvertT oShape

    objPicShape.Wra pFormat.Type = WdWrapType.wdWr apNone
    objPicShape.Wra pFormat.Side = WdWrapSideType. wdWrapBoth

    objPicShape.Hei ght = 20
    objPicShape.Wid th = 60Lennie_Kuah@xtr a.co.nz
    FInsertLine 2

    'display fullname and jobtitle
    iWord.Selection .TypeText Text:=.Fields(" SignatureFullNa me")
    FInsertLine 1
    iWord.Selection .TypeText Text:=.Fields(" SignatureTitle" )

    iWord.Selection .ParagraphForma t.Alignment = wdAlignParagrap hLeft

    End If

    End With

    Set objPic = Nothing
    Set objPicShape = Nothing
    Set adoRstSign = Nothing

    End Function
  • sashi
    Recognized Expert Top Contributor
    • Jun 2006
    • 1749

    #2
    Hi there,

    Are you inserting data to a plain word document or a template (.dot)?

    Originally posted by lenniekuah
    I have written a VB6 program extracting Customers Name and address from a table to incorporate it into a letter and output it to MS WORDS. At the bottom of the letter I tried to insert a digitised signature TIFF formatted file. Instead of the signature appearing on each letter generated by WORDS, all the signatures congregated at the last Letter. Being new to VB6 and just don't know what went wrong

    Here are sample of the script that insert the TIFF signature file into WORDS.

    Private Function FPrintSignature (ByVal iClientId As Long, iWord As Word.Applicatio n, iDoc As Word.Document)

    'vbcity version
    Dim objPic As InlineShape
    Dim objPicShape As Word.Shape

    Dim strSql As String
    Dim strSignPath As String

    strSql = "Select * from Signature where ClientId = " & iClientId
    adoRstSign.Open strSql, adoConn, adOpenKeyset
    With adoRstSign
    If Not .EOF Then
    strSignPath = .Fields("SignPa th")

    Set objPic = iDoc.InlineShap es.AddPicture(s trSignPath, False, True, iWord.Selection .Range)
    Set objPicShape = objPic.ConvertT oShape

    objPicShape.Wra pFormat.Type = WdWrapType.wdWr apNone
    objPicShape.Wra pFormat.Side = WdWrapSideType. wdWrapBoth

    objPicShape.Hei ght = 20
    objPicShape.Wid th = 60Lennie_Kuah@xtr a.co.nz
    FInsertLine 2

    'display fullname and jobtitle
    iWord.Selection .TypeText Text:=.Fields(" SignatureFullNa me")
    FInsertLine 1
    iWord.Selection .TypeText Text:=.Fields(" SignatureTitle" )

    iWord.Selection .ParagraphForma t.Alignment = wdAlignParagrap hLeft

    End If

    End With

    Set objPic = Nothing
    Set objPicShape = Nothing
    Set adoRstSign = Nothing

    End Function

    Comment

    Working...