Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Excel Chart to PDF OLE err
Message
General information
Forum:
Visual FoxPro
Category:
Object Oriented Programming
Environment versions
Visual FoxPro:
VFP 9
OS:
Windows XP
Network:
Windows 2003 Server
Database:
Visual FoxPro
Miscellaneous
Thread ID:
01060492
Message ID:
01061232
Views:
19
Thanks,

I have found that safe way to handle the file naming is to alter the PDF995.ini so that the file name is always 'something' and my application is now renaming the file to its proper name.

I know how sendkey can backfire on you, and try to avoid AMAP.

I also see that the PDF's can be saved to HTML's - you know for such a free product PDF995 is just what was needed. I'm back on schedule to complete the project.

Thank you for the good info...



>Edgar,
>
>Probably you know, but just in case. The portion "on Ne01:" is the PORT as it si stored in the registry for particular printer. It may be changed by user or by administrator; also on another PC the PORT name may be different. So, you need to extract that registry value and use it in your program to create the ActivePrinter string dynamically.
>
>Now to your question. It is PDF printer/driver that have or does not have the ability to accept the file name and omit the dialog. See if it is documented in its manual and what could be the syntax.
>
>Also you may try Excel.SendKeys method to send the key combination to the dialog. Like:
>
>
>oExcel.ActivePrinter = "Win2PDF on Ne00:"
>* activate printer dialog, choose the printer, click OK to see filename dialog, type file name c:\hello.pdf, go to SAVE button
>oExcel.SendKeys ("%fp{tab 5}{DOWN 9}{ENTER}{tab 2}{ENTER}c:\HELLO.PDF{tab 2}{ENTER}", 0)
>
>
>As usual with sendkeys method:
>- it is sensitive to the language used on the PC, it may work on English PC, but not on France
>- the keycombination may depend on the Excel version, etc...
>
>>Excellent,
>>
>>loExcel.ActivePrinter = "PDF995 on Ne01:" && "PDF995 ON PDF995PORT"
>>
>>Now how can I pass a file name to avoid the PDF995 asking for FileName?
>>
>>
>>>Edgar,
>>>
>>>I would start with recording a Macro to see whether the entire approach works with the printer you selected. If OK, then I would go to the VBA Editor, review the code, and translate it to VFP.
>>>
>>>
>>>>Yuri (and anyone),
>>>>
>>>>That message still doesn't help identify the reason for the OLE IDispatch exception code 0 from Microsoft Office Excel: Unable to set the ActivePrinter property of the Application class... error generated as indicated below
>>>>I have verified spelling from current printer array - but still get an error!
>>>>
>>>>
>>>>How can I have excel print the chart to the PDF995 and provide the nameing convention to the file to be created?
>>>>
>>>>
>>>>>objXLsheet.application.ActivePrinter = "Win2PDF on Ne00:"
>>>>>
>>>>>See also message #898535
>>>>>
>>>>>
>>>>
>>>>loExcel = createobject("Excel.Application")
>>>>loExcel.workbooks.open(GETFILE('xls','Excel To PDF!'))
>>>>loExcel.Visible = .t.
>>>>loExcel.ActiveWorkbook.Sheets(2).Activate
>>>>loExcel.ActivePrinter = "PDF995 on PDF995PORT" && <<<------ Error Here!
>>>>loExcel.ActiveWorkbook.Sheets(2).PrintOut
>>>>loExcel.quit
>>>>RELEASE loExcel, loWorkbook, loSheet
>>>>
>>>>>>What is the proper syntax to set Active Printer?
Edgar L. Bolton, B.S. B.B.A.
Previous
Reply
Map
View

Click here to load this message in the networking platform