VBA script that saves excel range as pdf

2019-03-13 21:24发布

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,

1条回答
趁早两清
2楼-- · 2019-03-13 22:29

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

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

查看更多
登录 后发表回答