vba:我想单独控制打印哪个工作表,用什么命令?
答案:2 悬赏:30 手机版
解决时间 2021-02-02 17:25
- 提问者网友:世勋超人
- 2021-02-02 09:08
vba:我想单独控制打印哪个工作表,用什么命令?
最佳答案
- 五星知识达人网友:琴狂剑也妄
- 2021-02-02 09:27
1、打印活动工作薄
Sub MyprintOut()
份数 =4
ActiveWorkbook.PrintOut Copies:=份数
End Sub
2、打印当前workbook,并集合打印模式
Sub printOut()
份数 = 5
ActiveWorkbook.PrintOut Copies:=份数, Collate:=True
End Sub
3、打印当前workbook的所有sheet
Sub printOut()
ActiveWorkbook.Worksheet.PrintOut
End Sub
4、打印隐藏的工作表
Sub printOut()
Worksheets("Sheet2").Activate
Worksheets("Sheet1").Visible = False
Application.ScreenUpdating = False
Worksheets("Sheet1").Visible = True
Worksheets("Sheet1").PrintOut
Worksheets("Sheet1").Visible = False
End Sub
Sub MyprintOut()
份数 =4
ActiveWorkbook.PrintOut Copies:=份数
End Sub
2、打印当前workbook,并集合打印模式
Sub printOut()
份数 = 5
ActiveWorkbook.PrintOut Copies:=份数, Collate:=True
End Sub
3、打印当前workbook的所有sheet
Sub printOut()
ActiveWorkbook.Worksheet.PrintOut
End Sub
4、打印隐藏的工作表
Sub printOut()
Worksheets("Sheet2").Activate
Worksheets("Sheet1").Visible = False
Application.ScreenUpdating = False
Worksheets("Sheet1").Visible = True
Worksheets("Sheet1").PrintOut
Worksheets("Sheet1").Visible = False
End Sub
全部回答
- 1楼网友:神鬼未生
- 2021-02-02 09:48
sub test()
dim sh as worksheet
dim i, x, y as integer
y = 0
for each sh in thisworkbook.sheets
if left(sh.name, 2) = "10" then
y = y + (sh.hpagebreaks.count + 1) * (sh.vpagebreaks.count + 1)
end if
next sh
x = 1
for each sh in thisworkbook.sheets
if left(sh.name, 2) = "10" then
sh.select
for i = 1 to (sh.hpagebreaks.count + 1) * (sh.vpagebreaks.count + 1)
sh.pagesetup.rightfooter = "共 " & y & " 页/第 " & x & " 页"
'sh.printpreview ’去掉这句前面的 ' 是预览
'sh.printout i, i ’去掉这句前面的 ' 是打印
x = x + 1
next i
end if
next sh
end sub
我要举报
如以上问答信息为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
大家都在看
推荐资讯