PDA

View Full Version : Adding Smilies/Emoticons to emails



johnske
07-07-2005, 07:32 PM
I did a search of this forum & the KB the other day and couldn't believe this question hadn't been asked before :devil: ...


I normally use Outlook Express and give Outlook a miss, however I might be persuaded to use it if there were some simple way to add some custom smilies to my emails.

What I'm thinking of is an add to the email toolbar of a smiley button so that when composing an email, I click it and a userform pops up with a list (pictures) of my smilies so I only need to click the smiley I want to insert it. (like the smiley thing here when posting {but smaller}).

Is this do-able? :devil:

Regards,
John

Scottie P
07-07-2005, 08:00 PM
Well, I can use Yahoo emoticons in a sig in OL2K so that should be a start... :O

Jacob Hilderbrand
07-07-2005, 08:50 PM
Have you checked out GetSmilie from http://www.vbaexpress.com/cooltools.php? You can download a trial version to see if it will work with Outlook Express.

Anne Troy
07-07-2005, 11:00 PM
John... just to confirm...

GetSmile DOES work in OE. Why? Because it actually creates a link to THEIR server to get the picture.

And they have some pretty cool (and very naughty) smilies. http://smilies.sofrayt.com/%5E/_950/lamer.gif

Scottie P
07-07-2005, 11:08 PM
hmmm, sorry...I got the impression that Johnske wanted to use the smilies in Outlook...not Outlook Express.:(

Think I'll head on over to the Kb for a while...:outtahere

S

johnske
07-08-2005, 01:44 AM
Hi All,

Had a look at 'GetSmilie' but that's not a freebie...

Used to have a setup from SmileyCentral in a previous Hard-Drive reincarnation and they were pretty cool (some were very rude also). I've tried to download it again several times lately but the link now appears to be dead.

Downloaded a setup from SmileyWorld a few days ago but didn't like the smilies they had and it was then a HELL of a job to uninstall it (it didn't like being uninstalled).

Thought Yahoo was only for Instant Messaging? - I have that for MSN Messenger...

I had thought this would be do-able in Outlook, not Outlook Express, and also thought that if someone took it on it'd also make a good KB entry

Regards,
John :)

Anne Troy
07-08-2005, 06:56 AM
There's no need, John. Smileys will work in OL or OE...no matter. They just need to be links to "live" graphics. The smilies here at vbax link to the smilies in the server folder. You can even use those, you just need to do html format email.

Ken Puls
07-08-2005, 09:09 AM
There's no need, John. Smileys will work in OL or OE...no matter. They just need to be links to "live" graphics. The smilies here at vbax link to the smilies in the server folder. You can even use those, you just need to do html format email.

I thought Jake stopped hotlinking on the server to prevent that?

John, my mother uses Incredimail with OE, I think. It sends some pretty funky things with backgrounds, smilies, etc...

May want to do a search for that.

Anne Troy
07-08-2005, 09:14 AM
I thought Jake stopped hotlinking on the server to prevent that?

Well, that's possible. I dunno.

Ivan F Moala
07-09-2005, 04:56 AM
These images are usually just animated gifs. All you really need is a cache of thes on your drive and the below code (which I have amended from my site) to do this from within Excel.....

This code inserts an image as a signature OR background



Option Explicit

'To create an HTML message that included an embedded image -- that, instead,
'all "" <img> "" tags had to use full URLs to public web addresses.
'The impossible has become possible, though, through the efforts of Outlook MVP Neo,
'who devised a method that uses undocumented MAPI properties and CDO.

'CDO = Microsoft? Collaboration Data Objects
'CDO does not represent a new messaging model, but rather an additional scripting interface
'to the Messaging Application Programming Interface (MAPI) model.

'for more info see;
'http://msdn.microsoft.com/library/default.asp?url=/library/en-us/cdo/html/_olemsg_overview_of_cdo.asp

'For versions see;
'http://msdn.microsoft.com/library/default.asp?url=/library/en-us/dncdsys/html/cdo_roadmap.asp

'In VBA or Visual Basic you will need to add a reference to the CDO 1.21 library to use this procedure.
'For client applications, you should install Outlook in order to install CDO.
'In Outlook 2000 and Outlook 2002, CDO is included, but you must explicitly select
'it during setup.

'Microsoft CDO 1.21 Library
'MAPI
'GUID = {3FA7DEA7-6438-101B-ACC1-00AA00423326}
'Path C:\PROGRA~1\COMMON~1\System\Mapi\1033\NT\CDO.DLL
'GUID Ref .AddFromGuid "{3FA7DEA7-6438-101B-ACC1-00AA00423326}",1,21
'.Item("MAPI")

'//
Const strHTMLCredit1 As String = _
"<br><br><b><i><FONT SIZE=2> Automation - Emailer by Ivan F Moala 2003"

Const strHTMLCredit2 As String = _
"<br><A HREF='http://www.xcelfiles.com'>Visit my Site</A></i></b><br><br>"
'//
Const CdoPR_ATTACH_MIME_TAG As Long = &H370E001E '&H3712001E
Const olSave = 0

Sub InsertPictureInEmail_V2()
'/////////////////////////////////////////
'// Ivan F Moala 17th March 2003 //
'// Amendment //
'// Ivan F Moala 30th June 2003 //
'// Credit to Outlook MVP Neo //
'// Testing under Xl2000 / WinXP //
'// Testing under Xl2003 / WinXP //
'/////////////////////////////////////////

'// Dimension variables using Latebinding
Dim objOutlookApp As Object
Dim objOutlookMessage As Object
Dim strHTMLBody As String
Dim objOutlookAppAttach As Object
Dim objOutlook_Att As Object
Dim strEntryID As String
Dim objSession As Object
Dim vFileImage As Variant

'// To counter the change in Dir due to MAPI
Dim strIniFolder As String

'
Dim blnSignature As Boolean

'// Use late binding 'Reference CDO
Dim objMsg As Object 'MAPI.Message
Dim objAttachs As Object 'MAPI.Attachments
Dim objAttach As Object 'MAPI.Attachment
Dim colFields As Object 'MAPI.Fields
Dim oField As Object 'MAPI.Field

'// Sheet
'Dim objPict As Object
'Dim MyChart As Chart
'Dim rgImgSend As Range

'//
strIniFolder = CurDir
LoadImg:
vFileImage = Application.GetOpenFilename("Image Files (*.gif),*.gif")
If TypeName(vFileImage) = "Boolean" Then Exit Sub

If MsgBox("Insert Signature (Yes) OR Background? (No)", vbYesNo, "aaa") = vbYes Then
blnSignature = True
Else
blnSignature = False
End If

'// Create an instance of Outlook (or use existing instance if it already exists)
On Error Resume Next
Set objOutlookApp = GetObject(, "Outlook.Application")

If Err.Number <> 0 Then
Set objOutlookApp = CreateObject("Outlook.Application")
'// We need the Application Open in order to NOT show as attachment
Shell objOutlookApp, vbMaximizedFocus
End If
On Error GoTo 0

'// Create a mail item
Set objOutlookMessage = objOutlookApp.CreateItem(0)
Set objOutlookAppAttach = objOutlookMessage.Attachments
'// add graphic as attachment to Outlook message
'// change path to graphic as needed
Set objOutlook_Att = objOutlookAppAttach.Add(vFileImage)

'// Lets save the Msg, this is so that the EntryID property
'// is set.
objOutlookMessage.Close olSave

'// Lets get the unique entry ID of the object.
'// EntryID property corresponds to the MAPI property PR_ENTRYID.
'// MAPI systems assign a permanent, unique ID string when an object
'// is created that does not change from one MAPI session to another.
'// Also, the EntryID changes when an item is moved into another folder.
strEntryID = objOutlookMessage.EntryID

Set objOutlookMessage = Nothing
' *** POSITION CRITICAL *** you must dereference the
' attachment objects before changing their properties
' via CDO
Set objOutlookAppAttach = Nothing

'// initialize CDO session
On Error Resume Next
Set objSession = CreateObject("MAPI.Session")
objSession.Logon "", "", False, False

'// get the message created earlier
Set objMsg = objSession.GetMessage(strEntryID)

'// set properties of the attached graphic that make
'// it embedded and give it an ID for use in an <IMG> tag
Set objAttachs = objMsg.Attachments
Set objAttach = objAttachs.Item(1)
Set colFields = objAttach.Fields

'// Set oField = oFieldsColl.Add (name, Class [, value] [, PropsetID] )
Set oField = colFields.Add(CdoPR_ATTACH_MIME_TAG, "image/gif")
Set oField = colFields.Add(&H3712001E, "MyIdent")

With objMsg
.Fields.Add "{0820060000000000C000000000000046}0x8514", 11, True
.Update
End With

'// Put any HTML you want - this is just an example Signature
strHTMLBody = "<hr><br>"
strHTMLBody = strHTMLBody & "<b>Here are the details you were looking for.</b><br>"
strHTMLBody = strHTMLBody & "<b>Get back to me ASAP</b><br>"
strHTMLBody = strHTMLBody & "<b>Looking forward to your reply.</b><br><br><br>"
strHTMLBody = strHTMLBody & "<b><i>Ivan F Moala</i></b><br><br><hr>"
strHTMLBody = strHTMLBody & "<IMG align=baseline border=0 hspace=0 SRC=cid:MyIdent>" & _
strHTMLCredit1 & strHTMLCredit2

'// Get the Outlook MailItem again
Set objOutlookMessage = objOutlookApp.GetNamespace("MAPI").GetItemFromID(strEntryID)

'// add HTML content -- the <IMG> tag
With objOutlookMessage
'// Now place HTML code in Body
.HTMLBody = IIf(blnSignature, strHTMLBody, "<BODY background=cid:MyIdent></BODY>")
.Display '// Show it
End With

'// cleanup
Set oField = Nothing
Set colFields = Nothing
Set objMsg = Nothing
Set objAttachs = Nothing
Set objAttach = Nothing
Set colFields = Nothing

objSession.Logoff

Set objSession = Nothing
Set objOutlookApp = Nothing
Set objOutlookMessage = Nothing

ChDir (strIniFolder)

End Sub

Scottie P
07-10-2005, 09:28 PM
Johnske, curious...did you get around to trying this out? I haven't as of yet.

Hi Ivan!! Great to see you round these parts!!

Scott

johnske
07-11-2005, 03:55 AM
Hi Scott, Ivan,

Scott, yes I have, but I'm getting a runtime error 438 (object doesn't support this property or method) on the line
vFileImage = Application.GetOpenFilename("Image Files (*.gif),*.gif")

Ivan, there is a mention about setting a reference to the CDO 1.21 library but I'm unable to find this DLL to set the reference.

Now, the text in the comments says that In Outlook 2000 and Outlook 2002, CDO is included, but you must explicitly select it during setup. It seems I can't use this cos I'm operating Win97 and Office 2000 (I assume Outlook 2000 is part of Win 2k, not Office 2k (cos I can't find it on my Office disc)).

Regards,
John :)