设为首页收藏本站Access中国

Office中国论坛/Access中国论坛

 找回密码
 注册

QQ登录

只需一步,快速开始

返回列表 发新帖
查看: 2846|回复: 4
打印 上一主题 下一主题

用那个函数或用什么方法可以判断出所在页的页码?

[复制链接]
跳转到指定楼层
1#
发表于 2006-6-16 14:32:00 | 只看该作者 回帖奖励 |倒序浏览 |阅读模式
用那个函数或用什么方法可以判断出所在页的页码?
分享到:  QQ好友和群QQ好友和群 QQ空间QQ空间 腾讯微博腾讯微博 腾讯朋友腾讯朋友
收藏收藏 分享分享 分享淘帖 订阅订阅
2#
发表于 2006-6-18 04:15:00 | 只看该作者
分页显示就可以啊
3#
发表于 2006-6-28 16:12:00 | 只看该作者
Sub PrintActivePage()

    Dim VPC     As Integer

    Dim HPC     As Integer

    Dim VPB     As VPageBreak

    Dim HPB     As HPageBreak

    Dim NumPage As Integer

   

    If ExecuteExcel4Macro("Get.Document(50)") = 0 Then

       MsgBox "Excel 找不到列印的內容"

       Exit Sub

    End If

   

    If ExecuteExcel4Macro("Get.Document(50)") = 1 Then

        ActiveSheet.PrintOut From:=1, To:=1, Copies:=1

        Exit Sub

    End If

   

    '先判斷編頁碼的順序也就是版面設定的循欄列印或循列列印

    If ActiveSheet.PageSetup.Order = xlDownThenOver Then

        HPC = ActiveSheet.HPageBreaks.Count + 1

        VPC = 1

    Else

        VPC = ActiveSheet.VPageBreaks.Count + 1

        HPC = 1

    End If

   

    NumPage = 1

   

    Application.ScreenUpdating = True

    ActiveWindow.View = xlPageBreakPreview

    For Each VPB In ActiveSheet.VPageBreaks

        If VPB.Location.Column > ActiveCell.Column Then Exit For

        NumPage = NumPage + HPC

    Next VPB

   

    For Each HPB In ActiveSheet.HPageBreaks

        If HPB.Location.Row > ActiveCell.Row Then Exit For

        NumPage = NumPage + VPC

    Next HPB

   

    '取得頁數後再判斷目前儲存格是否在列印範圍中

    If Intersect(ActiveSheet.UsedRange, ActiveCell) Is Nothing Then

        MsgBox "目前儲存格不在列印範圍中"

    Else

        MsgBox "目前儲存格在第" & NumPage & "頁"

        ActiveSheet.PrintOut From:=NumPage, To:=NumPage, Copies:=1

    End If

    ActiveWindow.View = xlNormalView

    Application.ScreenUpdating = True

End Sub
4#
 楼主| 发表于 2006-7-4 22:51:00 | 只看该作者
谢谢,就是有点复杂

5#
发表于 2006-7-4 23:13:00 | 只看该作者
[em03]太复杂
您需要登录后才可以回帖 登录 | 注册

本版积分规则

QQ|站长邮箱|小黑屋|手机版|Office中国/Access中国 ( 粤ICP备10043721号-1 )  

GMT+8, 2024-6-8 01:34 , Processed in 0.087395 second(s), 28 queries .

Powered by Discuz! X3.3

© 2001-2017 Comsenz Inc.

快速回复 返回顶部 返回列表