Office中国论坛/Access中国论坛

标题: EXCEL打印按扭 [打印本页]

作者: renshenbin    时间: 2006-11-20 22:39
标题: EXCEL打印按扭
请问如何编写打印按扭的程序,让其可以打印所选定的区域。
作者: 方漠    时间: 2006-11-21 00:53
工作表里建一按钮,COPY如下代码试一下.

Sub PrintSelectionRange()

If Selection Is Nothing Then
    MsgBox "lease select the cells which need to print...", vbInformation
    Else
    If Selection.Count = 1 Then
      If MsgBox("You have selected a single cell, continue to print?", vbQuestion + vbYesNo) = vbYes Then
         Selection.PrintOut
      End If
     Else
        Selection.PrintOut
    End If
End If

End Sub
作者: qqqqqqwwwwww    时间: 2006-12-22 06:01
可以设置一个字符串来代替下面的a1到g19

Range("A1:G19").Select
    ActiveSheet.PageSetup.PrintArea = "$A$1G$19"

Selection.PrintOut





欢迎光临 Office中国论坛/Access中国论坛 (http://www.office-cn.net/) Powered by Discuz! X3.3