Dim App As New MSExcel.Application Dim Wb As MSExcel.WorkBook = App.WorkBooks.Open("D:\test.xls") Dim Ws As MSExcel.WorkSheet = Wb.WorkSheets(1) With Ws.PageSetup .ScaleWithDocHeaderFooter = True .AlignMarginsHeaderFooter = True End With app.visible = True