Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Still Trying to Fax from within VFP9 2

Status
Not open for further replies.

KimPP

Programmer
Jun 6, 2013
13
0
0
CA
Hi all,

I really appreciate all the help I've received so far, but I'm still hitting a snag in my attempt to send a fax through a dedicated fax SBS. Here is a snippet of my code:

SET OLEOBJECT ON
FaxServer = CREATEOBJECT("FaxServer.FaxServer")
&& FaxServer.CONNECT ("\\ntl-fsv-01\fax")
FaxServer.CONNECT ("\\ntl-fsv-01")
myFaxDocument = CREATEOBJECT("FaxComEx.FaxDocument")
&& myFaxDocument = CREATEOBJECT("FaxDocument.FaxDocument")
myFaxSender = myFaxDocument.Sender
myFaxSender.LoadDefaultSender()
myFaxDocument.Subject = "Test" && ie Report Title
myFaxDocument.Recipients.ADD("6139690470", "TEST") && ie faxnumber, receiptname
&& Suggested to help Debug
&& myFaxDocument.Submit()
&& back to program
faxPtrName = GETPRINTER()
&& SET PRINTER TO NAME ("\\ntl-fsv-01")
SET PRINTER TO NAME ("192.168.144.01")

On this last line, I get the message: "Error accessing printer spooler".

Can anyone think why this could be??

On a lower line of code,

myFaxDocument.Submit()

I get the error "OLE error 0x8002000e: Invalid number of parameters"

Again, I am stumped. Any help greatly appreciated!

Cheers,
Kim
 
I've tried removing the "Connected" and I've tried putting in the actual printer name as a string.

Have you put a SET STEP ON line immediately prior to your command
myFaxDocument.ConnectedSubmit (FaxServer)

If you had, it should launch the TRACE WINDOW

When that occurs you can then manually go to your VFP Command window and type
myFaxDocument. (<--don't forget the last period)
VFP's Intellisense will then show you what options are available and most likely help you figure out what is needed.

Good Luck,
JRB-Bldr


 
That's a great idea, thanks, I'll do that right now!

Kim
 
Another day, another error (or two, or three....) lol

JRB, thank you so very much for that tip about setting step on and then typing in the command window. A star for you!

I am still trying everything I can think of to get this program to fax something. Here is what I've tried, and the resulting error messages:


myFaxDocument.CoverPageType (notes) ---> OLE error code 0x80020011: Does not support a collection

myFaxDocument.ConnectedSubmit (FaxServer) ---> OLE IDispatch Error Code 0 from FaxComEx.Fax Document1: At least one recipient must exist
(above, I have the user input the recipient name and store it to "receiptname")
myFaxDocument.Recipients>ADD(faxnum, receiptname)

and, finally, I tried:

myFaxDocument.Send (FaxServer) ---> OLE Error 0x80020006: Unknown Name

Please help if you can; my deadline to get this up and running is today!

Cheers,
Kim
 
Just noticed this thread and thought the code below might help.
You would have to adapt it of course, this is being used with vfp8 and on a Win XP and Win 7 machine.
Works fine with both, BUT it is using the local FAX printer and a Local modem.
Haven't tried this code with the Fax server on the Server itself.
I have other faxing setup through VFP using the Fax server but it is through Outlook 2007 and a whole different story.

Good Luck, Clyde

*M_faxname contains the name of the FAX service on this computer, in this case "FAX"
* this routine assumes MANY faxes being generated
Set Print To Name (M_FAXNAME)
Use fax Orde cdl In 0 && dbf containing all info for each fax
Sele fax
Do Whil !Floc()
Wait Wind "Locking FAX file."
Endd
*Generate a unique fax file name**************
M_FAXFILE="0001"
m_faxf=Curdir(Sys(5))
Do Whil File(m_faxf+"FAX"+M_FAXFILE+".TXT")
M_FAXFILE=Righ("000"+Allt(Str(Val(M_FAXFILE)+1)),4)
Endd
M_FAXFILE=m_faxf+"FAX"+M_FAXFILE+".TXT"
*Add pertinent info to a FAX DBF
If !Seek("ZZZZ")
Appe Blan
Else
Reca
Endi
Repl FAXcdl With sy_cdl();
,faxfile With M_FAXFILE;
,FAXuser With pwname;
,FAXto With arc.Name;
,faxphone With arc.fax;
,faxtype With "SO";
,FAXdate With Date();
,FAXtime With Time()
UNLOCK
*Send the report to the FAX printer that was set above and to file using name created above.
Repo Form INsoackG To File &M_FAXFILE Noco
Set Prin To Defa
Use In fax


***************************
***This is a separate routine to send a group of faxes contained in the file generated above
SET OLEOBJECT ON
sele fax
SET DELE OFF
set orde to
m_faxcount=0
scan for faxyn
IF FILE(allt(fax.faxfile)) && confirm the file to be faxed exists
m_faxcount=m_faxcount+1
loFaxServer=CreateObject("FaxServer.FaxServer")
loFaxServer.Connect('') && this is when using a LOCAL fax printer,;
** if using the fax server it might be \\ServermainFax or something
loFaxDoc=loFaxServer.CreateDocument(allt(fax.faxfile))
loFaxDoc.FaxNumber=ALLT(fax.FAXphone)
loFaxDoc.RecipientName=ALLT(fax.FAXto)
loFaxDoc.Send()
loFaxServer.Disconnect()
RELEASE loFaxServer,loFaxDoc
DELE FILE (fax.faxfile)
ELSE
?"NOT FOUND!! "+FAX.FAXTO+" "+fax.faxfile
ENDI
scat memv blan
m.faxcdl="ZZZZ"
gath memv
DELE
ends
WAIT WIND "All done with fax list."
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top