我在将多个工作表保存为 pdf 时遇到问题。我查看了这个网站(和其他网站)并找到了与我一直在使用的类似的代码。但是,我修改的代码更类似于Save multiple sheet to .pdf和http://www.vbaexpress.com/kb/getarticle.php?kb_id=160的组合。
但是,我在最后一行“424:需要对象”中遇到错误。如果您能引导我朝着正确的方向前进,将不胜感激!
Sub SaveAs()
Dim Fname As String
Dim Fpath As String
Fname = Sheets("Sheet1").Range("FT5").Text 'The Cell I want to use as my file name
Fpath = "C:" 'my location
ThisWorkbook.Sheets(Array("Sheet 1", "Sheet 2")).Select 'My selected tabs
ActiveSheets.ExportAsFixedFormat Type:=xlTypePDF, _
FileName:=Fpath & "\" & Fname & ".pdf", _
Quality:=xlQualityStandard, _
IncludeDocProperties:=True, _
IgnorePrintAreas:=False, _
OpenAfterPublish:=True 'My issue is with this line....
End Sub