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 wOOdy-Soft on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Sending faxes from VB

Status
Not open for further replies.

markbeeson

Programmer
Jun 14, 2003
19
NZ
I'm trying to get my app to send faxes straight from the application.
All I can manage to do is get the MS fax wizard to start up.

Does anyone know of a better way to just send the fax number to an application or serivice or something(!) to send the fax without prompts?

Seriously consider buying software to bundle with the app but it would have to affordable! Many thanks.
 
Symantec WinFax Pro will let you do this, however not sure how expensive it is to buy/release.

Hammy
 
Hi markbeeson,

Firstly what OS will the app be running on.

I have written an App that uses the Windows XP fax that can be controlled progmatically. You can set the the recipients name, number and all sorts of other info.

You can either hard code all the information or use variables from textboxes on a form.

Let me know if this will be any use to you and I will post the code with some basic instructions.

this may well be able to be adapted for other windows versions that have the fax application installed.

Cheers

Symon.

Everything has an answer, it's just knowing the right question to ask. !!!!
 
Crikey Yes Please!
The app needs to run on all versions of windows although we could exclude win95.

Send me the code please!!

Many thanks.
 
Hi markbeeson,

Here you go:-


Firstly you have to have the fax system installed on Windows XP and add the Fax reference to your project.

Place the following code in the Declarations

Public g_objFaxDocument As New FAXCOMEXLib.FaxDocument
Public g_objFaxSender As FaxSender

This next bit of code goes in a sub like commandbuttton1_click()

'Error handling
On Error GoTo Error_Handler


'Remove the previous recipient, if there is one. Otherwise, the fax would be sent to
'recipients that accumulate in the FaxRecipients collection from each previous use of the form.
If g_objFaxDocument.Recipients.Count = 1 Then g_objFaxDocument.Recipients.Remove (1)

'Set no cover page as default
g_objFaxDocument.CoverPageType = fcptNONE


'Set the rest of the fax document properties
g_objFaxDocument.Note = ""
g_objFaxDocument.Subject = "enter whatever subject you like here" 'or you can have a text box that you assing a variable to and then put the variable name here with out the speech marks.
g_objFaxDocument.Recipients.Add faxnum.Text, faxname.Text 'fanum.text and faxname.text are the names of texboxes on a the form.
g_objFaxDocument.Sender.Name = "your name"
g_objFaxDocument.Sender.FaxNumber = "your fax number"
g_objFaxDocument.Sender.OfficePhone = "your phone number"
'Include the attachment if the attachment checkbox is selected
g_objFaxDocument.Body = "document you want to fax" ' if you are faxing say a word document you would use g_objFaxDocument.Body = "c:\my documents\your fax.doc"


'Submit the document to the server
Call g_objFaxDocument.Submit("")

Exit Sub
Error_Handler:
MsgBox "Error number: " & Hex(Err.Number) & ", " & Err.Description
Err.Clear


Hope this makes sense.

Remember you also have to add the fax reference to your project.

Let me know if you have problems you can e-mail me if you like. symon@eu4ic-it.co.uk

Cheers

Symon.

Everything has an answer, it's just knowing the right question to ask. !!!!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top