Solved vba inseret signature (with jpeg)

GaryPanic

Smoke me a Kipper,Skipper
Local time
Today, 15:28
Joined
Nov 8, 2005
Messages
3,309

ok the above states that you can edit your html signature to insert a picture .. - i must be doing somthing wrong ...



<xml xmlns:o="urn:schemas-microsoft-com:office:office">
<o:MainFile HRef="../EUTest.htm"/>
<o:File HRef="themedata.thmx"/>
<o:File HRef="colorschememapping.xml"/>
"C:\Users\gpa\AppData\Roaming\Microsoft\Signatures\EUTest_files\image001.jpg" *** does not work ??
<o:File HRef="image002.jpg"/>
<o:File HRef="filelist.xml"/>
</xml>

can someone use a big stick to hit this with .. or point out where I have been stupid ...
lol
 
..


this is where it states this .....

In the .htm file in the signatures directory you can edit the htm file. The pictures are stored as relative path and when you use the code it looses that path so if you use discrete path it will be able to find the pictures. so go into the file and look for any relative paths and make them discrete.
"/Microsoft/Signatures/picturefile.jpg"
change that to include the whole path
"/root/user/blah blah../Microsoft/Signatures/picturefile.jpg"
 
@GaryPanic. What does "*** does not work ??" mean? Do you see a blank image placeholder on your email? If so, what happens if you right-click on it? What options do you see? If you see an option to "download" the image, what happens if you click on it?
 
this image cannot currently be displayed ..
and righthand click - just gives the formating function for a picture - no links etc ..(or downloads)

(sorry for the vagueness )
 
Do you see a blank image placeholder on your email? Yes
 
Am I missing a point here?
Why not just edit the signature in outlook and then save it with the image in?
Or are you trying to dynamically change the signature image, in which case why not create the whole signature block as the last part of the email message?
 
I might be missing the point myself (LOL)

the edited outlook signature does not add the pictures to the email I get the "this image cannot currently be displayed .."

which is why i was trying to hard code(?) the path to the image to the signature

chances are its me being a little bit dumb ( well quite a lot dumb)!
 
Do you see a blank image placeholder on your email? Yes
If you enter the following in your File Explorer or Web Browser, do you see the image?

C:\Users\gpa\AppData\Roaming\Microsoft\Signatures\EUTest_files\image001.jpg
 
Its work - but its ok I am data sensitive aware .. and the logo is just a jpeg of a company picture
 
Its work - but its ok I am data sensitive aware .. and the logo is just a jpeg of a company picture
It wasn't that. I was asking because in some work environment, IT implements a group policy where no images will show up in Outlook emails anyway. So, trying this exercise at work where images are not allowed is probably not the best scenario, if it applies to your situation.
 
Gary
As already explained, inline images in emails are often blocked due to email security settings.
You can easily test this by sending a test HTML email to yourself from my example CDO Email Tester app .
That includes a PNG image but the chances are you will just see an empty placeholder with a red X
 
Mine often has an option I can click to display images, looks like this:

outlook-not-downloading-images-automatically.png
 
park this one to one side while I rethink this
but your responses are awesome ! and thank you
 
You don't want to replace the whole line with your discrete reference, just the relevant bit within it, so it should still look something like this

<v:imagedata src="C:\Users\UserName\AppData\Roaming\Microsoft\Signatures\Darrell_files\image001.png" o:title="Darrell"/>

See if that helps
 
this is the Correct way to use your Signature on an Outlook/CDO email.
first create a function that will extract your signature:
Code:
'arnelgp
    Private Function ReadSignature(sigName As String) As String
       'Note:
       'sigName is the name of the htm file
       'example:  "mySignature.htm" (only filename, does not include the Path)
       Dim oFSO, oTextStream, oSig As Object
       Dim appDataDir, sig, sigPath, filename As String
       appDataDir = Environ("APPDATA") & "\Microsoft\Signatures"
       sigPath = appDataDir & "\" & sigName

       Set oFSO = CreateObject("Scripting.FileSystemObject")
       Set oTextStream = oFSO.OpenTextFile(sigPath)
       sig = oTextStream.ReadAll
       ' 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

sample code that calls the function:
Diff:
Dim oApp As Object
Dim oMail As Object
Dim sSignature As String

'retrieve the signature
sSignature = ReadSignature("yourHTMFileHere.htm")

Set oApp = CreateObject("Outlook.Application")
Set oMail = oApp.CreateItem(0)
With oMail
    .To = "someEmailAddressHere"
    .Subject = "Sample signature test"
    .HTMLBody = "Here is your signature" & "<p><BR/><BR/></p>" & sSignature
    .Display
End With
 

Users who are viewing this thread

Back
Top Bottom