使用VBA和CDO邮件对象通过短信向iPhone发送箭头“↑”字符 [英] Send up arrow `↑` character to iPhone with SMS using VBA and a CDO mail object
问题描述
我需要使用VBA和CDO邮件对象向iPhone发送向上箭头↑
。
I need to send an up arrow ↑
to an iPhone with SMS using VBA and a CDO mail object.
我的尝试如下:
Unicode:
subj = ChrW(8593) & " Up " & ChrW(8593)
HTML:
subj = "↑ Up ↑"
上述两种方法都会导致iPhone收到?用于Unicode或
作为字符串文字。& uarr;用于
; Up& uarr;
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 ↑
?
推荐答案
解决方案:
我一直在寻找一些特殊字符语法,但问题不在于构造消息。我需要将 .BodyPart.Charset =utf-8
添加到CDO.Message对象并使用Unicode Chrw(8593)
我需要的地方。
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
显然, .BodyPart.Charset
涵盖主题和邮件正文,因为我可以在两者中使用unicode。
Apparently, .BodyPart.Charset
covers both the subject and the message body as I was able to use unicode in both.
任何计划将此代码用于其自身目的的人都需要通过工具,参考资料将 Microsoft CDO for Windows 2000库添加到他们的项目中。
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.
这篇关于使用VBA和CDO邮件对象通过短信向iPhone发送箭头“↑”字符的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!