Problem Printing VB.NET Reports with Excel 2003 "PrintOut method of Workbook class failed"
Posted on 2006-05-01
I am at a loss with the problem I am having lately. I am trying to print an excel worksheet to file with acrobat distiller. I can set the printer with no problem, checked that it was correct. But, when attempting to print to file, I get the error "PrintOut method of Workbook class failed." I suppose it could be a COM object or reference that I am missing, but that would be surprising considering I can manipulate all aspects of the excel worksheet without any problems. The only time I get this error is when I try to print to file. Using just ".Printout" works fine. The line of code that causes the error is below. It worked fine until I had to reformat and reinstall visual studio 2000.
objWksht.Printout(PrintToFile:=True, PrToFileName:=SavePath & "\FILENAME.prn")
The reason I cannot use the ".Printout" method is because this is in a loop creating several files and I cannot have the user needing to type in the file name every time.