Martin-Swannie
asked on
VB6 Inserting Outlook Signature using vb6
I use the following code to send an email
Public Sub SendEmail(iRecipient, iSubject As String, iAttach As String, iBody As String)
Dim myOlApp As Outlook.Application
Dim myItem As MailItem
Dim myAttachments As Attachments
Dim MyItemSize As Long
Dim sUserName As String
Dim oInsp As Outlook.Inspector
Set myOlApp = CreateObject("Outlook.Appl ication")
Set myItem = myOlApp.CreateItem(olMailI tem)
Set myAttachments = myItem.Attachments
Set oInsp = myItem.GetInspector
myItem.Recipients.Add iRecipient
myItem.Subject = iSubject
myItem.Attachments.Add iAttach
myItem.ReadReceiptRequeste d = True
' myItem.Body = iBody
myItem.Display
End Sub
This code displays the correct default signature. As soon as I uncomment the line 'myItem.Body = iBody' it deletes the signature and only shows the body text- Any Ideas
Public Sub SendEmail(iRecipient, iSubject As String, iAttach As String, iBody As String)
Dim myOlApp As Outlook.Application
Dim myItem As MailItem
Dim myAttachments As Attachments
Dim MyItemSize As Long
Dim sUserName As String
Dim oInsp As Outlook.Inspector
Set myOlApp = CreateObject("Outlook.Appl
Set myItem = myOlApp.CreateItem(olMailI
Set myAttachments = myItem.Attachments
Set oInsp = myItem.GetInspector
myItem.Recipients.Add iRecipient
myItem.Subject = iSubject
myItem.Attachments.Add iAttach
myItem.ReadReceiptRequeste
' myItem.Body = iBody
myItem.Display
End Sub
This code displays the correct default signature. As soon as I uncomment the line 'myItem.Body = iBody' it deletes the signature and only shows the body text- Any Ideas
ASKER
I will try passing an empty string and let u know
ASKER
Passing an empty string also deletes the signature
can you check the contents of ibody? maybe that string contains the signature
ASKER
ibody only contains text which the user enters in a text box. Under the text I want to display the Default Outlook Signature. If I exclude the ibody then the Signature displays correctly. As soon as ibody is added it deletes the Signature and only displays the ibody text. i.e. it does not insert iBody it seems to overwrite the Signature
So you have definitely inspected the text passed into iBody? (by the way, it should really read sBody as i refers to a numeric).
From what I gather, outlook automation does not include signature by default. Only way I knew how to add a signature when I used outlook auto is to open the signature file and add in the contents into iBody.
From what I gather, outlook automation does not include signature by default. Only way I knew how to add a signature when I used outlook auto is to open the signature file and add in the contents into iBody.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
instead of commenting out, what if you passed in a empty string, does that still produce a signature?