I have created a small application, using RobDogg88's example, to create e-mails automatically, when needed.
I have tried without success to get the correct signature appended.
The signature itself appends OK, but the three images don't show up, just leaving a place-holder and the message "This image cannot currently be displayed."
Code:
.HTMLBody = .HTMLBody & "Please contact me, by e-mail or Skype, if you have any difficulties with this.<BR/><BR/>"
.HTMLBody = .HTMLBody & "</p>"
.HTMLBody = .HTMLBody & "</pre>"
Sig_Dir = Environ("APPDATA") & "\Microsoft\Signatures\"
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oTextStream = oFSO.OpenTextFile(Sig_Dir & "New_Teqhou.htm")
Signature = oTextStream.ReadAll
.HTMLBody = .HTMLBody & Signature
.Importance = olImportanceHigh
.ReadReceiptRequested = False
.Display 'Show the email message and allow for editing before sending
This is what the result shows as:
I also tried reading the signature and editing it to add full paths for the relevant images, but no difference:
Code:
Private Function ReadSignature(sigName As String) As String
Sig_Dir = Environ("APPDATA") & "\Microsoft\Signatures\"
Set oFSO = CreateObject("Scripting.FileSystemObject")
Set oTextStream = oFSO.OpenTextFile(Sig_Dir & sigName)
Signature = oTextStream.ReadAll
HTM_Dir = Replace(sigName, ".htm", "_files\")
Signature = Replace(Signature, sigName, Sig_Dir & HTM_Dir)
Signature = Replace(Signature, "Teqhou_logo.jpg", Sig_Dir & "/Teqhou_logo.jpg")
Signature = Replace(Signature, "MS_Partners.jpg", Sig_Dir & "/MS_Partners.jpg")
Signature = Replace(Signature, "MS_Dynamics.jpg", Sig_Dir & "/MS_Dynamics.jpg")
Signature = Replace(Signature, "New_Teqhou_Files/image002.png", Sig_Dir & HTM_Dir & "/image002.png")
Signature = Replace(Signature, "New_Teqhou_Files/image003.png", Sig_Dir & HTM_Dir & "/image003.png")
Signature = Replace(Signature, "New_Teqhou_Files/image004.png", Sig_Dir & HTM_Dir & "/image004.png")
Dim temphtm As Integer
temphtm = FreeFile
Open Sig_Dir & "Test.htm" For Output As temphtm
Print #temphtm, Signature
Close temphtm
ReadSignature = Signature
End Function
I've tried saving "signature" as a separate .htm file , but that confuses me more! If I double-click that file, the e-mail opens with all images intact!
Anyone have any idea where I'm going wrong?