我有以下代码,它在“Inc”范围之后的代码的主题行中给出了编译错误:“预期:结束语句”。
此代码是模块的一部分,该模块打开MS Outlook电子邮件并将数据表中的特定单元格(从Userform生成)输入到电子邮件的“主题”字段中。
代码:
'This bit tells it where to send the email to, what the subject line is etc
.to = "princess_ingelise@yahoo.co.uk"
.CC = "princess_ingelise@yahoo.co.uk"
.BCC = ""
.Subject = "Inc" Range("H6").Value & " " & Range("G12").Value & " - " & Range("G14").Value & " " & Range("H8").Value
.HTMLBody = RangetoHTML(rng)
.Display
End With
On Error GoTo 0
这是否足够信息?
答案 0 :(得分:2)
你能检查一下是不是因为错过了“&”运营商
.Subject = "Inc" Range("H6").Value & " " & Range("G12").Value & " - " & Range("G14").Value & " " & Range("H8").Value
应该是
.Subject = "Inc" & Range("H6").Value & " " & Range("G12").Value & " - " & Range("G14").Value & " " & Range("H8").Value