似乎几乎可以正常工作,但是这种束缚告诉我,文件名与其位置之间没有“ \”。我该怎么添加。
Sub Macro1()
ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, _
Filename:=Range("f6").Text, _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=False
Set Mail_Object = CreateObject("Outlook.Application")
With Mail_Object.CreateItem(o)
.Subject = Range("f6").Text
.To = "EMAIL"
.Body = "Daily movement file attached" & Chr(13) & Chr(13) & _
"Regards," & Chr(13) & "SCD" & Chr(13) & "AAAAAA"
strlocation = "C:\Users\User\Desktop\macro save" & Range("f6").Text & ".pdf"
.Attachments.Add (strlocation)
.Send
End With
Set Mail_Object = Nothing
End Sub
答案 0 :(得分:0)
因此,您只缺少/
吗?
更改此:
strlocation = "C:\Users\User\Desktop\macro save" & Range("f6").Text & ".pdf"
...对此:
strlocation = "C:\Users\User\Desktop\macro save\" & Range("f6").Text & ".pdf"