保存为选定的工作表(保存为pdf,用户提示保存到位置)

时间:2015-06-09 15:58:25

标签: excel vba excel-vba

我需要将选定的工作表保存为PDF,但我希望用户提示应该将pdf保存到哪里,因此我使用了SaveAs代码。 以下代码只保存第一张表...请告诉我如何修改代码,以便只保存选定的表格?

Sub saveas()

Sheets(Array("TITLE", "CONTENTS", "Units Shipped", "Discs Shipped", "AVG TAT NR", "AVG TAT RO", "DELIVERY PERFORMANCE")).Select

Dim v As Variant
v = Application.GetSaveAsFilename("Sound Performance KPI For " & Sheets("TITLE").Range("A16").Value & " - " & Format(Now(), "ddmmyy_hhmm") & ".pdf", "PDF Files (*.pdf), *.pdf")

If VarType(v) = vbString Then
    ActiveWorkbook.ExportAsFixedFormat Type:=xlTypePDF, Filename:=v, _
    Quality:=xlQualityStandard, IncludeDocProperties:=True, _
    IgnorePrintAreas:=False, From:=1, To:=3, OpenAfterPublish:=True
End If

End Sub

1 个答案:

答案 0 :(得分:0)

我愚蠢......只是改变了活跃的工作手册'到'活动表'

ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:=v, _