8

I need to send an up arrow to an iPhone with SMS using VBA and a CDO mail object.

My attempts are as follows:

Unicode:

subj =  ChrW(8593) & " Up " & ChrW(8593)

HTML:

subj =  "↑ Up ↑"

Both of the above methods result in the iPhone receiving either a ? Up ? for the Unicode or ↑ Up ↑ as a string literal.

Does anyone know the correct syntax for an up arrow ?

  • 1
    You want to send [Oliver Queen](http://www.imdb.com/character/ch0028557/?ref_=tt_cl_t1) by SMS? – ThunderFrame May 12 '17 at 00:22
  • Wouldn't that need a `StrConv` call? – Mathieu Guindon May 12 '17 at 00:24
  • lol; I would suppose that his quiver might get caught in the SMTP port so I'd settle for a ↑ character. –  May 12 '17 at 00:26
  • @Mat'sMug - If the iPhone is translating HTML to rich text then I think the HTML would work but it doesn't. Also, the Unicode is being stripped at the server or through receiving SMS, not when I send it. I know you can send an iPhone message using emoticons, etc. but I do not know how they encode them. [edit] I'll try sending as strconv(.., vbunicode). –  May 12 '17 at 00:29
  • Sorry @Mat'sMug, `strconv(.., vbunicode)` makes a garbled mess of the subject and truncates the message body altogether (likely from hitting a 0x0 character). –  May 12 '17 at 00:35
  • Found a solution; see below. –  May 12 '17 at 01:04

1 Answers1

8

Solution:

I was looking for some 'special character' syntax but the problem was not in the construction of the message. I needed to add .BodyPart.Charset = "utf-8" to the CDO.Message object and use the Unicode Chrw(8593) where I needed it.

Sub sendMSSG(sbj As String, mssg As String)
    Dim cdoMail As New CDO.Message
    On Error GoTo err_Report

    With cdoMail
        With .Configuration.Fields
            .Item("http://schemas.microsoft.com/cdo/configuration/sendusing") = cdoSendUsingPort '2
            .Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
            .Item("http://schemas.microsoft.com/cdo/configuration/smtpserverport") = 465
            .Item("http://schemas.microsoft.com/cdo/configuration/smtpserver") = "my.smtpserverserver.net"
            .Item("http://schemas.microsoft.com/cdo/configuration/smtpauthenticate") = cdoBasic  '1
            .Item("http://schemas.microsoft.com/cdo/configuration/smtpusessl") = True
            .Item("http://schemas.microsoft.com/cdo/configuration/sendusername") = sFROM
            .Item("http://schemas.microsoft.com/cdo/configuration/sendpassword") = sFROMPWD
            .Item("http://schemas.microsoft.com/cdo/configuration/smtpconnectiontimeout") = 6
            .Update
        End With
        .BodyPart.Charset = "utf-8"     '<~~ THIS WAS REQUIRED
        .Subject = sbj
        .From = sFROM
        .To = sPHONEMSSGNO
        .Bcc = vbNullString
        .Cc = vbNullString
        .TextBody = mssg
        .Send
    End With

    Exit Sub

err_Report:
    Debug.Print Err.Number & ": " & Err.Description

End Sub

Apparently, .BodyPart.Charset covers both the subject and the message body as I was able to use unicode in both.


Anyone planning to use this code for their own purposes needs to add the Microsoft CDO for Windows 2000 library to their project via Tools, References.