ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Need Help in Printing (https://www.excelbanter.com/excel-programming/349079-need-help-printing.html)

Pedro

Need Help in Printing
 
Hi
I need some help in a couple of things, hope you could help me.

1º I need to print a word document from excel, and the document is in the
same dir as the excel file.
2º I want to print a list of items and if it passes the two page count it
automatically sets up the second page with the same header row as the first
one.

All this in VBA code. with a button on a different sheet.

Thank you for your attention

Pedro

bpeltzer

Need Help in Printing
 
No idea about item 1.

As for 2, you can record the step in PageSetup whereby you indicate that row
1 should be repeated on every page printed:
With ActiveSheet.PageSetup
.PrintTitleRows = "$1:$1"
End With


"Pedro" wrote:

Hi
I need some help in a couple of things, hope you could help me.

1º I need to print a word document from excel, and the document is in the
same dir as the excel file.
2º I want to print a list of items and if it passes the two page count it
automatically sets up the second page with the same header row as the first
one.

All this in VBA code. with a button on a different sheet.

Thank you for your attention

Pedro


gajendra_vba

Need Help in Printing
 

Hi,
You may solve your first problem with following lines of code.

Sub print_doc()
Dim obj As New Word.Application
Set obj = New Word.Application
obj.Visible = True
Documents.Open " File path "
ActiveDocument.PrintOut Range:=wdPrintCurrentPage (Optional parameter)
End Sub

Before trying this code, do not forget to add reference of MS Word
Object library. For other assistance mail to my personal id.


--
gajendra_vba
------------------------------------------------------------------------
gajendra_vba's Profile: http://www.excelforum.com/member.php...o&userid=29935
View this thread: http://www.excelforum.com/showthread...hreadid=496581



All times are GMT +1. The time now is 08:29 PM.

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