Const vbDoubleQuote As String = """" 'represents 1 double quote (")
Const vbSingleQuote As String = "'" 'represents 1 single quote (')
Private WithEvents myOlItems As Outlook.Items
Private Sub Application_Startup()
Dim olApp As Outlook.Application
Dim objNS As Outlook.NameSpace
Set olApp = Outlook.Application
Set objNS = olApp.GetNamespace("MAPI")
Set myOlItems = objNS.GetDefaultFolder(olFolderInbox).Items
End Sub
Private Sub myOlItems_ItemAdd(ByVal item As Object)
Dim Msg As Outlook.MailItem
Dim Title As String
Dim Body As String
Dim Message As String
Set Msg = item
Title = Msg.Subject
Body = Msg.Body
TargetURL = "https://api.pushbullet.com/v2/pushes"
Set HttpReq = CreateObject("WinHttp.WinHttpRequest.5.1")
HttpReq.Option(4) = 13056
HttpReq.Open "POST", TargetURL, False
HttpReq.SetCredentials "user", "password", 0
HttpReq.setRequestHeader "Authorization", "Bearer myAPI"
HttpReq.setRequestHeader "Content-Type", "application/json"
Message = "{""channel_tag"": ""myChannel"", ""type"": ""note"", ""title"": " & _
vbDoubleQuote & Title & vbDoubleQuote & ", ""body"": " & _
vbDoubleQuote & Body & vbDoubleQuote & "}"
HttpReq.Send (Message)
大家好,对不起,如果这个问题对你们来说太简单了,但我对此一无所知。
以上是我的代码,在消息中我将标题放在代码中间阅读我定义的内容:
(""title"": " & _
vbDoubleQuote & Title & vbDoubleQuote & ") as "Title = Msg.Subject".
但是仍然在推送没有任何消息的空消息时,只是一个空消息。
我是否错误地定义了字符串?