ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Printing subset of pages dynamically using excel macros (https://www.excelbanter.com/excel-discussion-misc-queries/47632-printing-subset-pages-dynamically-using-excel-macros.html)

nsgargya

Printing subset of pages dynamically using excel macros
 

Hi All:

I am trying to use Excel VBA macro to dynamically print certain number
of pages.

Let me explain:

I have a print button in the second page of my spreadsheet. When I
click this button I have to start ptinting from second page onwards .
But the end is dynamic. Depending on the number of records available it
can vary (i.e can be 10 records or 40 or 30 or2 etc).

I would really appreciate if some one could help me with this scenario.


I very badly need this in my project.

Thanks in advance

nsgargya


--
nsgargya
------------------------------------------------------------------------
nsgargya's Profile: http://www.excelforum.com/member.php...o&userid=27632
View this thread: http://www.excelforum.com/showthread...hreadid=471511


Ron de Bruin

Hi

Try

Sub Test()
Dim TotPages As Long
TotPages = Application.ExecuteExcel4Macro("GET.DOCUMENT(50)")
ActiveSheet.PrintOut From:=2, To:=TotPages
End Sub



--
Regards Ron de Bruin
http://www.rondebruin.nl


"nsgargya" wrote in message
...

Hi All:

I am trying to use Excel VBA macro to dynamically print certain number
of pages.

Let me explain:

I have a print button in the second page of my spreadsheet. When I
click this button I have to start ptinting from second page onwards .
But the end is dynamic. Depending on the number of records available it
can vary (i.e can be 10 records or 40 or 30 or2 etc).

I would really appreciate if some one could help me with this scenario.


I very badly need this in my project.

Thanks in advance

nsgargya


--
nsgargya
------------------------------------------------------------------------
nsgargya's Profile: http://www.excelforum.com/member.php...o&userid=27632
View this thread: http://www.excelforum.com/showthread...hreadid=471511





All times are GMT +1. The time now is 07:04 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com