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:"
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"
>>>loExcel.ActiveWorkbook.Sheets(2).PrintOut
>>>loExcel.quit
>>>RELEASE loExcel, loWorkbook, loSheet
>>>
>>>>>What is the proper syntax to set Active Printer?