将excel范围保存为pdf的VBA脚本 [英] VBA script that saves excel range as pdf

查看:306
本文介绍了将excel范围保存为pdf的VBA脚本的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我尝试将范围扩展到我的代码中,但我没有运气。我想要在vba中有一个脚本来保存为特定的页面或特定的范围到pdf。
任何帮助将不胜感激。



这是我一直在使用的:

  ActiveSheet.ExportAsFixedFormat类型:= xlTypePDF,文件名:= _ 
c:\Book1.pdf,质量:= _
xlQualityStandard,IncludeDocProperties:= True ,IgnorePrintAreas:= False,_
OpenAfterPublish:= True

谢谢,

解决方案

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



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


I tried implimenting a range into my code, but I'm having no luck. I'd like to be able to have a script in vba to 'save as' a specific sheet or specific range to pdf. Any help would be much appreciated.

Here is what I've been working with:

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

Thanks,

解决方案

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

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

这篇关于将excel范围保存为pdf的VBA脚本的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆