Send up arrow `↑` character to iPhone with SMS using VBA and a CDO mail object

后端 未结 1 1009
失恋的感觉
失恋的感觉 2020-12-20 17:18

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:

<
相关标签:
1条回答
  • 2020-12-20 17:46

    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.

    0 讨论(0)
提交回复
热议问题