我有以下代码,它给了我编译错误:"预期:语句结束"在"Inc"范围之后的代码主题行中。
此代码是模块的一部分,该模块打开MS Outlook电子邮件并将数据表中特定单元格(从用户表单生成)中的数据输入到电子邮件的主题字段中。
代码:
'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
这些信息是否足够?
你能检查一下是否是因为缺少"&"运算符
吗.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