declare activesheet to array for printing 2 sheets of workbook

依然范特西╮ 提交于 2019-12-24 22:25:21

问题


I am trying to print the active worksheet and another worksheet with general information (in the same workbook) at the same time. (Recto verso, which my printer does automatically, no code needed for that)

In my workbook I have multiple sheets that use the same code for printing. Now I would like to add the sheet with general information called "Huurvoorwaarden" to an array so it is printed automaticaly and at the back side of the active sheet.

I have tried multiple sollutions like dim / set activesheet.name, and codes which I have found on the web. nothing works. I know that when I would change "activesheet" to Sheet1, that would work, but only for sheet 1.

Could you please help me?

Here is what I have got: (all my older attempts are deleted)

    'Print Active Sheet and sheet Huurvoorwaarden
    Worksheets(Array("activesheet.name", "Huurvoorwaarden")).PrintOut

回答1:


The name of the active sheet is not the string literal "ActiveSheet.Name", it is the property ActiveSheet.Name.

So you need to use

Worksheets(Array(Activesheet.Name, "Huurvoorwaarden")).PrintOut


来源:https://stackoverflow.com/questions/46970978/declare-activesheet-to-array-for-printing-2-sheets-of-workbook

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!