word vba 怎么获取当前光标所在页码,并获取该页有多少行
1个回答
展开全部
Sub Macro2()
Dim r, p, r0, p0, rr, pp
p= Selection.Information(wdActiveEndPageNumber) '当前页码
r= Selection.Information(wdFirstCharacterLineNumber) '当前行
'数行数
p0 = p
rr = r
Do
Selection.MoveDown Unit:=wdLine, Count:=1
pp = Selection.Information(wdActiveEndPageNumber)
r0 = Selection.Information(wdFirstCharacterLineNumber)
If pp > p Then
'退回原处
Selection.MoveUp Unit:=wdLine, Count:=(rr - r + 1)
Exit Do
End If
If rr = r0 Then
'退回原处
Selection.MoveUp Unit:=wdLine, Count:=(rr - r)
Exit Do
End If
rr = r0
Loop
MsgBox "当前页码:" & p & vbCrLf & "本页总行数:" & rr
End Sub
申请加悬赏分!!!
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |