It seems that your PDF printer driver asks you for a filename. That's bad, as you can't (easily/conveniently) remote control that input.
It's weird that the macro recorder records a call to ExecuteExcel4Macro - in my opinion, it should have recorded a call to ActiveWorksheet.PrintOut. But maybe you pressed a special "Print to PDF" button or something instead of pressing the generic "Print" button in Excel?
Translating from VB to Win32::OLE is fairly easy, but you'll have to learn a bit of VB or be willing to experiment a bit. Start with:
my $excel = Win32::OLE->new('Excel.Application'); my $workbook = $excel->Workbooks->Add($absolute_path_to_excel_filename +); my $first_worksheet = $workbook->Sheets(1); $first_worksheet->PrintOut();
Then, you'll have to look at what parameters you're allowed to pass to ->PrintOut. These are documented in the MSDN or the Office Object Model Documentation (available when you press F2 to get the object browser and then see the documentation of the methods of the Workbook object. Also see WIN32, OLE, Excel, and Printing which might have more code and information.
In reply to Re^5: Converting Excel to Pdf
by Corion
in thread Converting Excel to Pdf
by merrymonk
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |