Home » Developer & Programmer » Forms » Getting the number of pages in excel sheet or current page using OLE2 (merged 5) (Oracle 10g forms on Windows XP)
icon1.gif  Getting the number of pages in excel sheet or current page using OLE2 (merged 5) [message #553038] Tue, 01 May 2012 05:08
actual_happiness
Messages: 1
Registered: May 2012
Junior Member
Hi,

I fill an excel sheet using CLIENT_OLE2 from form,
I want to get the number of pages in sheet or the number of current page,
after searching for solution I found this example on VB:

Sub GetPageCount()
Dim iView As Integer
Dim iHorizontalBreaks As Integer
Dim iVerticalBreaks As Integer
Dim iPageCount As Integer

On Error Resume Next

'go to the range and set PrintArea to the range name
Application.Goto Reference:="ABC"
ActiveSheet.PageSetup.PrintArea = Selection.Address

'turn monitor flickering/updating off
Application.ScreenUpdating = False

'remember current View setting
iView = Application.ActiveWindow.View

'refresh the print area
Application.ActiveWindow.View = xlPageBreakPreview

'set view back
Application.ActiveWindow.View = xlNormalView

'turn monitor flickering/updating back on
Application.ScreenUpdating = True

'calculate the # of pages
iHorizontalBreaks = ActiveSheet.HPageBreaks.Count + 1
iVerticalBreaks = ActiveSheet.VPageBreaks.Count + 1
iPageCount = iHorizontalBreaks * iVerticalBreaks

I need at least the sentence that returns (ActiveSheet.HPageBreaks.Count),
How can I implement this using CLIENT_OLE2?

Any assistance would be welcome.
Thanks
Previous Topic: help order by parameter radio buttons
Next Topic: Record History is not enabling
Goto Forum:
  


Current Time: Fri Jul 05 21:22:37 CDT 2024