emery


As resolved in "VFP Fax Integration" thread, I have been using Jaime's method to fax Reports with graphic/image and it works very well for VFP6.

set printer to name "Fax"
report form myReport to file "myfile.tif" noconsole

Recently I compiled and ran my program using VFP9, I got the following Program Error:

OLE IDispatch exception code 0 from FaxComEx.FaxDocument.1: Operation failed...

I found out my VFP9 program will work without error if I select Fax device in 'Printer and Faxes' window and 'Set as Default Printer' before running it (I don't need to do this with VFP6). But it is not a good solution.

Does anyone know how to best resolve the problem

Thanks,

Emery




Re: Fax Report Using VFP9

dni


May be you need to put:

SET REPORTBEHAVIOR 80 &&before report command







Re: Fax Report Using VFP9

emery

I tried that, but it doesn't help.

I was thinking maybe I have to figure out a way to programmatically set/reset Fax as Default Printer before/after executing the commands. Does anyone know how to do that under VFP9

Thanks,

Emery






Re: Fax Report Using VFP9

dni

You may try first:

SET PRINTER TO NAME "PrinterName" && it is printer spooler name ...from settings > printers

and reset with

SET PRINTER TO DEFAULT






Re: Fax Report Using VFP9

dni

Sorry, you should have "printer Fax" in printers list to work. Anyway it should works.

You may also try to use a windows script, I am not sure if will work if the "printer Fax" is not in priters list (from control panel).






Re: Fax Report Using VFP9

emery

That sequence has always been in my program. It works for VFP6, but not for VFP9.

.....

myFaxDocument = createobject("FaxComEx.FaxDocument")
myFaxSender = myFaxDocument.Sender
myFaxSender.LoadDefaultSender()
myFaxDocument.Subject = "Test"
myFaxDocument.Recipients.Add(faxnumb, name)

SET PRINTER TO NAME (faxPtrName)

tmpFaxFile = homedir + "\tmpMSFax.tif"
REPORT FORM (fform) TO FILE (tmpFaxFile) noconsole

myFaxDocument.Body = (faxFile)

myFaxDocument.Submit(ServerName)

RELEASE myFaxDocument
SET PRINTER TO DEFAULT

......

Under VFP9, if I leave the default printer as HP Laser Jet, the REPORT FORM rendered it as a PCL file which then failed when Submit. If I manually set FAX as Default Printer before executing the program, the REPORT FORM will generate tif format file correctly and Submit successfully.

So I am wondering is there other programmatically way to replace the manually step of setting Fax as default printer

Emery





Re: Fax Report Using VFP9

dni

With command

GETPRINTER()

can you see the fax and select it





Re: Fax Report Using VFP9

dni

You may try to use windows script SetDefaultPrinter:

http://news2news.com/vfp/ group=57&function=940






Re: Fax Report Using VFP9

dni

...but I am not sure if the problem is from vfp or os (if fax service is started).






Re: Fax Report Using VFP9

emery

Yes, the Fax service was installed and started properly. I can use GETPRINTER() to select it. And that is how it works perfectly under VFP6, but just not under VFP9. I am wondering if it is a bug for VFP9 and try to walk around.

I'll try your suggestion of windows script SetDefaultPrinter if I got the chance.

Thanks,

Emery





Re: Fax Report Using VFP9

JLB4536

Just a suggestion, make sure you have NOT saved the printer environment on the REPORT FORM. This will confuse the file. You can deselect this option in the report tab from 'tools'.






Re: Fax Report Using VFP9

emery

Using Win32 GetDefaultPrinter and SetDefaultPrinter functions solved my problem. Thanks dni.

Emery