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
excelapp.Visible=True
Dim pagesetup As Microsoft.Office.Interop.Excel.PageSetup
workbook = excelapp.Workbooks.open(path)
worksheet=CType(workbook.Sheets("Sheet1),microsoft.Office.Interop.Excel.Worksheet)
worksheet.Activate
pagesetup.PrintArea = pagesetup.PrintArea
workbook.Save()