ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to print last page of sheet? (https://www.excelbanter.com/excel-programming/313546-how-print-last-page-sheet.html)

kcm

How to print last page of sheet?
 
Hi,

I would like to print only the last page of a sheet with the simple
click on a button, but I cannot find a way to program that.

Thanks for any help on the subject.

Kees


Ron de Bruin

How to print last page of sheet?
 
Hi

Try this

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


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


"kcm" wrote in message ...
Hi,

I would like to print only the last page of a sheet with the simple click on a button, but I cannot find a way to program that.

Thanks for any help on the subject.

Kees




Frank Kabel

How to print last page of sheet?
 
Hi
use the following:
Sub print_last
Dim i As Integer
i = ExecuteExcel4Macro("Get.Document(50)")
ActiveWindow.SelectedSheets.PrintOut From:=i, To:=i, _
Copies:=1, Collate:=True
End Sub


--
Regards
Frank Kabel
Frankfurt, Germany

"kcm" schrieb im Newsbeitrag
...
Hi,

I would like to print only the last page of a sheet with the simple
click on a button, but I cannot find a way to program that.

Thanks for any help on the subject.

Kees



kcm

How to print last page of sheet?
 
Frank,

Nice trick, works fine.

Thanks,
Kees

Frank Kabel wrote:

Hi
use the following:
Sub print_last
Dim i As Integer
i = ExecuteExcel4Macro("Get.Document(50)")
ActiveWindow.SelectedSheets.PrintOut From:=i, To:=i, _
Copies:=1, Collate:=True
End Sub


--
Regards
Frank Kabel
Frankfurt, Germany

"kcm" schrieb im Newsbeitrag
...

Hi,

I would like to print only the last page of a sheet with the simple
click on a button, but I cannot find a way to program that.

Thanks for any help on the subject.

Kees





kcm

How to print last page of sheet?
 
Ron,

Thanks. Is this documented somewhere?

Kees


Ron de Bruin wrote:

Hi

Try this

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






All times are GMT +1. The time now is 10:40 PM.

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