- Local time
- Today, 11:58
- Joined
- Oct 29, 2018
- Messages
- 22,506
I thought this thread was about email signatures. Is your signature a jpg?
I thought this thread was about email signatures. Is your signature a jpg?
This I understand.The email signature is the signature from outlook.
So far so good...In the sample code from arnelgp it uses the standard outlook signatures.
This is where I get lost. Where did that reference to an "image" come from? Did Arnel use an image as a signature? If not, did you? Are you saying his sample works except when you use an image in your Outlook signature? Did you modify his code?All works fine except that when the email opens it doesn't display the image.
Are you saying his code displays a Form in Access that shows the signature? Or are you saying Access opens Outlook and displays the signature correctly, but it disappears when you send the message, because you don't see it when you open the email in Outlook?It does show in the preview display in access. It just somehow does not let me display it in Outlook.
Hello @The_Doc_ManI just want to confuse and clarify at the same time. Remember that there is also such a thing as a digital signature; essentially, a hash if your digital certificate, and you can sign an Outlook document with your digital (security) signature as well. You have to do a few gyrations to "reveal" the correct command button (for the Outlook application) to use for this purpose, in the same way that you can send an encrypted e-mail - again having to do a trick or two to reveal the correct command button.
The "signature" is not part of the formal protocol of SMTP. I.e. there is a .To, .CC, .BCC, .Subject, .From, .Body, etc.... but no .Signature component. It is an addendum / insert / concatenation to the .Body portion whether using text or HTML for the body type.
Sub Mail_Outlook_With_Signature_Html_2()
' Don't forget to copy the function GetBoiler in the module.
' Working in Office 2000-2016
Dim OutApp As Object
Dim OutMail As Object
Dim strbody As String
Dim SigString As String
Dim Signature As String
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
strbody = "<H3><B>Dear Customer Ron de Bruin</B></H3>" & _
"Please visit this website to download the new version.<br>" & _
"Let me know if you have problems.<br>" & _
"<A HREF=""http://www.rondebruin.nl/tips.htm"">Ron's Excel Page</A>" & _
"<br><br><B>Thank you</B>"
'Change only Mysig.htm to the name of your signature
SigString = Environ("appdata") & _
"\Microsoft\Signatures\Mysig.htm"
If Dir(SigString) <> "" Then
Signature = GetBoiler(SigString)
Else
Signature = ""
End If
On Error Resume Next
With OutMail
.To = "ron@debruin.nl"
.CC = ""
.BCC = ""
.Subject = "This is the Subject line"
.HTMLBody = strbody & "<br>" & Signature
.Send 'or use .Display
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
Function GetBoiler(ByVal sFile As String) As String
'Dick Kusleika
Dim fso As Object
Dim ts As Object
Set fso = CreateObject("Scripting.FileSystemObject")
Set ts = fso.GetFile(sFile).OpenAsTextStream(1, -2)
GetBoiler = ts.readall
ts.Close
End Function
Sub Mail_Outlook_With_Signature_Html_2()
' Don't forget to copy the function GetBoiler in the module.
' Working in Office 2000-2016
Dim OutApp As Object
Dim OutMail As Object
Dim strbody As String
Dim SigString As String
Dim Signature As String
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
strbody = "<H3><B>Dear Customer Ron de Bruin</B></H3>" & _
"Please visit this website to download the new version.<br>" & _
"Let me know if you have problems.<br>" & _
"<A HREF=""http://www.rondebruin.nl/tips.htm"">Ron's Excel Page</A>" & _
"<br><br><B>Thank you</B>"
'Change only Mysig.htm to the name of your signature
SigString = "Mysig.htm"
If Dir(SigString) <> "" Then
Signature = ReadSignature(SigString)
Else
Signature = ""
End If
On Error Resume Next
With OutMail
.To = "ron@debruin.nl"
.CC = ""
.BCC = ""
.Subject = "This is the Subject line"
.HTMLBody = strbody & "<br>" & Signature
.Send 'or use .Display
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
Private Function ReadSignature(sigName As String) As String
' arnelgp
'
' sigName should include the .htm extension
'
Dim appDataDir As String
Dim sig As String
Dim sigPath As String
Dim fileName As String
appDataDir = Environ$("APPDATA") & "\Microsoft\Signatures"
sigPath = appDataDir & "\" & sigName
With CreateObject("Scripting.FileSystemObject")
sig = .OpenTextFile(sigPath).ReadAll
End With
' fix relative references to images, etc. in sig
' by making them absolute paths, OL will find the image
fileName = Replace$(sigName, ".htm", "_files/")
sig = Replace$(sig, fileName, appDataDir & "\" & fileName)
ReadSignature = sig
End Function
'Change only Mysig.htm to the name of your signature
SigString = "Mysig.htm"
If Dir(SigString) <> "" Then
Sub Mail_Outlook_With_Signature_Html_2()
' Don't forget to copy the function GetBoiler in the module.
' Working in Office 2000-2016
Dim OutApp As Object
Dim OutMail As Object
Dim strbody As String
Dim SigString As String
Dim Signature As String
Set OutApp = CreateObject("Outlook.Application")
Set OutMail = OutApp.CreateItem(0)
strbody = "<H3><B>Dear Customer Ron de Bruin</B></H3>" & _
"Please visit this website to download the new version.<br>" & _
"Let me know if you have problems.<br>" & _
"<A HREF=""http://www.rondebruin.nl/tips.htm"">Ron's Excel Page</A>" & _
"<br><br><B>Thank you</B>"
'Change only Mysig.htm to the name of your signature
SigString = "Mysig.htm"
Signature = ReadSignature(SigString)
On Error Resume Next
With OutMail
.To = "ron@debruin.nl"
.CC = ""
.BCC = ""
.Subject = "This is the Subject line"
.HTMLBody = strbody & "<br>" & Signature
.Send 'or use .Display
End With
On Error GoTo 0
Set OutMail = Nothing
Set OutApp = Nothing
End Sub
Private Function ReadSignature(sigName As String) As String
' arnelgp
'
' sigName should include the .htm extension
'
Dim appDataDir As String
Dim sig As String
Dim sigPath As String
Dim fileName As String
appDataDir = Environ$("APPDATA") & "\Microsoft\Signatures"
sigPath = appDataDir & "\" & sigName
If Len(Dir$(sigPath)) = 0 Then Exit Function
With CreateObject("Scripting.FileSystemObject")
sig = .OpenTextFile(sigPath).ReadAll
End With
' fix relative references to images, etc. in sig
' by making them absolute paths, OL will find the image
fileName = Replace$(sigName, ".htm", "_files/")
sig = Replace$(sig, fileName, appDataDir & "\" & fileName)
ReadSignature = sig
End Function
ok change the code i gave with this one:
Code:Sub Mail_Outlook_With_Signature_Html_2() ' Don't forget to copy the function GetBoiler in the module. ' Working in Office 2000-2016 Dim OutApp As Object Dim OutMail As Object Dim strbody As String Dim SigString As String Dim Signature As String Set OutApp = CreateObject("Outlook.Application") Set OutMail = OutApp.CreateItem(0) strbody = "<H3><B>Dear Customer Ron de Bruin</B></H3>" & _ "Please visit this website to download the new version.<br>" & _ "Let me know if you have problems.<br>" & _ "<A HREF=""http://www.rondebruin.nl/tips.htm"">Ron's Excel Page</A>" & _ "<br><br><B>Thank you</B>" 'Change only Mysig.htm to the name of your signature SigString = "Mysig.htm" Signature = ReadSignature(SigString) On Error Resume Next With OutMail .To = "ron@debruin.nl" .CC = "" .BCC = "" .Subject = "This is the Subject line" .HTMLBody = strbody & "<br>" & Signature .Send 'or use .Display End With On Error GoTo 0 Set OutMail = Nothing Set OutApp = Nothing End Sub Private Function ReadSignature(sigName As String) As String ' arnelgp ' ' sigName should include the .htm extension ' Dim appDataDir As String Dim sig As String Dim sigPath As String Dim fileName As String appDataDir = Environ$("APPDATA") & "\Microsoft\Signatures" sigPath = appDataDir & "\" & sigName If Len(Dir$(sigPath)) = 0 Then Exit Function With CreateObject("Scripting.FileSystemObject") sig = .OpenTextFile(sigPath).ReadAll End With ' fix relative references to images, etc. in sig ' by making them absolute paths, OL will find the image fileName = Replace$(sigName, ".htm", "_files/") sig = Replace$(sig, fileName, appDataDir & "\" & fileName) ReadSignature = sig End Function
I created a whole new module again, still no luck.i am sorry that it does not work for you.
i made a short video of what i have (working in me, with same Code i uploaded).
the Signature is a jpg image.
Well whattayouknow.... I totaly missed that one.Did you try the method in the code I presented at the beginning of the thread?
As far as I'm aware it works.