View Single Post
  #2   Report Post  
Ron de Bruin
 
Posts: n/a
Default

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