Excel 2013 64位VBA语法错误“编译错误:”预期:语句结束“

我有以下代码,它给了我编译错误:在“Inc” 范围之后的主题行代码中的“期望:语句结束”。

此代码是打开MS Outlook电子邮件的模块的一部分,并从数据表中的特定单元格(从用户窗体生成)input到电子邮件的“主题”字段中。

代码:

'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 

这是足够的信息吗?

你可以检查是否因为缺less“&”运算符

 .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