VilkoP
asked on
Email generated via MS access not showing image within autosignature correctly
I have Ms access database that we are usiing to email quotes to a clients.
We are using MS Outlook 2003, and have Autosignture configured.
when i use outlook the signature comes up correctly including the image.
However when i do that from within the MS Access, the email that gets generated show only the placeholder for the image, but shows the rest of the text correctly.
Inside the image placeholder i have the following text:
"The image can not be displayed. Your computer may not have enough memory to open the image,
the image may have been corupted. Restart your computer, and than open the the file again.
If the red x still appears, you may have to delete the image and then insert it again."
Here is the code it is using to generate it:
-------------------------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---
Private Sub btnEmail_Click()
Dim vMessage As String
Dim vEmail As String
Dim vEmpEmail As String
Dim myOlApp As Object
Dim myItem As Object
Dim sSignatureFile As String
Dim iHandle As Integer
Dim sLine As String
Set myOlApp = CreateObject("Outlook.Appl ication")
Set myItem = myOlApp.CreateItem(0)
vEmail = Nz(DLookup("[fldFirstClien tEmail]", "[tblClient]", "[fldClientID] = " & Forms!frmD005Quote!fldClie ntID), "<enter_email_address>")
vEmpEmail = Nz(DLookup("[fldEmployeeEm ail]", "[tblEmployee]", "[fldEmployeeID] = " & Forms!frmD005Quote!fldEmpl oyeeID), "<enter_email_address>")
'vMessage = "!!! Please attach pdf report !!!"
'I use Admin, better to use API but suffice's for this example
'Name of my signature I defined in outlook is called test
sSignatureFile = "C:\Documents and Settings\" & Environ("Username") & "\Application Data\Microsoft\Signatures\ test.htm"
'print to pdf and attach to email
'------------------------- ---------- ---------- ---------- ---------- ---------- ---------- ---------
Dim blRet As Boolean
Dim sAttachmentFileName As String
sAttachmentFileName = GetPdfFilePath() & "Quote Number " & Me.Text2
If [fldClientType] = 2 Then
blRet = ConvertReportToPDF("rptQuo teCompanyP rint", vbNullString, _
sAttachmentFileName & ".pdf", False, False, 0, "", "", 0, 0)
Else
blRet = ConvertReportToPDF("rptQuo tePrint", vbNullString, _
sAttachmentFileName & ".pdf", False, False, 0, "", "", 0, 0)
End If
If blRet = True Then
myItem.Attachments.Add (sAttachmentFileName & ".pdf")
Else
vMessage = "!!! Please attach pdf report !!!"
End If
'------------------------- ---------- ---------- ---------- --
With myItem
.To = vEmail
.Subject = "Quote Details"
.SentOnBehalfOfName = vEmpEmail
.CC = "archive@building.com"
.HTMLBody = vMessage
'Add signature - if signature file exists then
If Dir$(sSignatureFile) <> "" Then
'Add two blank lines
.HTMLBody = .HTMLBody & vbCrLf & vbCrLf
iHandle = FreeFile
Open sSignatureFile For Input As #iHandle
Do While Not EOF(iHandle)
Line Input #iHandle, sLine
.HTMLBody = .HTMLBody & sLine
Loop
Close #iHandle
End If
myItem.Display
End With
Set myItem = Nothing
Set myOlApp = Nothing
End Sub
-------------------------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---------- ---
Any idea whay this this is not coming through when generated via ms access.?
Thanks in advance...
cube
We are using MS Outlook 2003, and have Autosignture configured.
when i use outlook the signature comes up correctly including the image.
However when i do that from within the MS Access, the email that gets generated show only the placeholder for the image, but shows the rest of the text correctly.
Inside the image placeholder i have the following text:
"The image can not be displayed. Your computer may not have enough memory to open the image,
the image may have been corupted. Restart your computer, and than open the the file again.
If the red x still appears, you may have to delete the image and then insert it again."
Here is the code it is using to generate it:
--------------------------
Private Sub btnEmail_Click()
Dim vMessage As String
Dim vEmail As String
Dim vEmpEmail As String
Dim myOlApp As Object
Dim myItem As Object
Dim sSignatureFile As String
Dim iHandle As Integer
Dim sLine As String
Set myOlApp = CreateObject("Outlook.Appl
Set myItem = myOlApp.CreateItem(0)
vEmail = Nz(DLookup("[fldFirstClien
vEmpEmail = Nz(DLookup("[fldEmployeeEm
'vMessage = "!!! Please attach pdf report !!!"
'I use Admin, better to use API but suffice's for this example
'Name of my signature I defined in outlook is called test
sSignatureFile = "C:\Documents and Settings\" & Environ("Username") & "\Application Data\Microsoft\Signatures\
'print to pdf and attach to email
'-------------------------
Dim blRet As Boolean
Dim sAttachmentFileName As String
sAttachmentFileName = GetPdfFilePath() & "Quote Number " & Me.Text2
If [fldClientType] = 2 Then
blRet = ConvertReportToPDF("rptQuo
sAttachmentFileName & ".pdf", False, False, 0, "", "", 0, 0)
Else
blRet = ConvertReportToPDF("rptQuo
sAttachmentFileName & ".pdf", False, False, 0, "", "", 0, 0)
End If
If blRet = True Then
myItem.Attachments.Add (sAttachmentFileName & ".pdf")
Else
vMessage = "!!! Please attach pdf report !!!"
End If
'-------------------------
With myItem
.To = vEmail
.Subject = "Quote Details"
.SentOnBehalfOfName = vEmpEmail
.CC = "archive@building.com"
.HTMLBody = vMessage
'Add signature - if signature file exists then
If Dir$(sSignatureFile) <> "" Then
'Add two blank lines
.HTMLBody = .HTMLBody & vbCrLf & vbCrLf
iHandle = FreeFile
Open sSignatureFile For Input As #iHandle
Do While Not EOF(iHandle)
Line Input #iHandle, sLine
.HTMLBody = .HTMLBody & sLine
Loop
Close #iHandle
End If
myItem.Display
End With
Set myItem = Nothing
Set myOlApp = Nothing
End Sub
--------------------------
Any idea whay this this is not coming through when generated via ms access.?
Thanks in advance...
cube
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.