Problem with Excel PageSetup class
Posted on 2003-02-27
I found this error when i try to use PageSetup class in my web project that create by VB.NET
Unable to set the LeftMargin property of the PageSetup class
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Runtime.InteropServices.COMException: Unable to set the LeftMargin property of the PageSetup class
my VB code is below.
dim xlApp as Excel.Application
dim xlWb as Excel.Workbook
dim xlWs as Excel.Worksheet
xlApp = CreateObject("Excel.Application")
xlApp.Visible = True
xlWb = xlApp.Workbooks.Add
xlWs = xlWb.Worksheets("Sheet1")
xlWs.PageSetup.LeftFooter = Format$(Now, "d/M/yyyy")
If i remark this line, I can create an Excel file without
any error. Does anyone can put me to the right way?
Thanks in advance,