Invoke code to do a Print area setup in Excel

Hi ,
Could anyone help me with this invoke code where I try to setup activesheet page setup to print area

It looks pagesetup.printarea not seem to work even when I declared Pagesetup

Dim excelapp As Microsoft.Office.Interop.Excel.Application
excelapp = New Microsoft.Office.Interop.Excel.ApplicationClass
Dim workbook As Microsoft.Office.Interop.Excel.Workbook
Dim worksheet As Microsoft.Office.Interop.Excel.Worksheet
Dim pagesetup As Microsoft.Office.Interop.Excel.PageSetup
workbook =

pagesetup.PrintArea = pagesetup.PrintArea

Try setting the PrintArea before saving the workbook:

pagesetup = worksheet.PageSetup
pagesetup.PrintArea = "$A$1:$D$10"  Specify the range to be printed

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.