vba 将 Excel 范围另存为 pdf

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/13073888/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-08 14:18:31  来源:igfitidea点击:

Save Excel range as pdf

excelvbapdfsave-as

提问by cheapkid1

I'd like to 'save as' a specific sheet or specific range to pdf.

我想将特定工作表或特定范围“另存为”到 pdf。

I tried implementing a range into my code.

我尝试在我的代码中实现一个范围。

Here is what I've been working with:

这是我一直在使用的:

ActiveSheet.ExportAsFixedFormat Type:=xlTypePDF, Filename:= _
  "c:\Book1.pdf", Quality:= _
  xlQualityStandard, IncludeDocProperties:=True, IgnorePrintAreas:=False, _
  OpenAfterPublish:=True

回答by SeanC

you have the code, just use a range instead of activesheet

你有代码,只需使用一个范围而不是 activesheet

e.g. Sheets("Sheet1").Range("B2:H28").ExportAsFixedFormat ...

例如 Sheets("Sheet1").Range("B2:H28").ExportAsFixedFormat ...