Hittade detta men det funkar inte.. Det är iof en bit som jag inte fattar..!
Sending a Fax
To send a fax, we have to create an instance of fax server object by using the Visual Basic “Create Object” function. After that, we have to establish a connection with the Active fax server. Here ‘Active fax server’ means the system with which the fax modem is connected.
After establishing the connection with the active fax server, we need to create FaxDoc object. Next, we have to specify the name of the file to be transmitted, as an argument to the CreateDoc method of FaxServer object.
The FaxDoc object is used to transmit fax documents and cover pages and to retrieve and set information about fax transmission. In this FaxDoc object, there is a method called Send that is used to transmit the document specified by FaxDoc object to the FaxNumber specified by the object. This example should give you an idea how to send the fax.
Dim FS As New FaxServer 'The FaxServer object to connect to
‘And disconnect from an active fax server
Dim FD As New FaxDoc
Dim FileName As String
FileName = “c:\test.doc”
'To transmit fax documents and cover pages, and
'To retrieve and set information about fax transmissions.
Set FD = FS.CreateDocument(FileName)
'Connecting to the server
FS.Connect ("\\ServerName")
MsgBox "Connection Established.........."
FS.Retries = 5
FS.RetryDelay = 3
'To display in the fax queue
FD.DisplayName = "TestFax"
FD.Send 'Transmits the document specified by the FaxDoc
'object to the fax number specified by the object.
Vad menas med detta?
Here ‘Active fax server’ means the system with which the fax modem is connected.
Då kommer den eviga frågan: På vilket sätt funkar det inte? Vad händer?
- Har du lagt till referensen till Faxcom Type Library?
- Har du bytt ut ServerName mot ett giltigt namn?
- Borde du inte ange numret nånstans: FD.FaxNumber = "xxxxxx"?
Jag har fortfarande inte fått till det trots grävande i MSDN.
Har sett lite andra inlägg på andra forum om folk som har lyckats.
Den mest beskrivande lägger jag här ifall ngn skulle vilja pröva.
Skriv gärna svar om hur ni gjorde ifall ni lyckas.!
Hi All... this is my first post here... hope it helps!
I've been reading posts and looking up articles on this subject...
Here's the procedure I've created to handle sending Fax's
This procedure has been tested on XP Home (server/client same pc), using VB6
I will test it in the production environment for the project I'm working on later today (NT Server/Win 98 client)
I will update here with the results of my testing...
Some of the code I've seen around has been written by people who seem to have been confused by the Client/Server nature of this method.
I'm assuming here that the intention is to allow a client app to send faxes via a server... of course you can also use this to send a fax on a standalone pc by connecting to yourself!
The basic technique is this:
You need a pc running NT/2000/XP that has the standard Fax service installed.
This will probably be the server on your network
The client pc will make use of this by creating an instance of the FaxServer object that is on the server
Here's the procedure:
Public Sub Fax(ByVal FileName As String, ByVal FaxNumber As String, ByVal FaxServerName As String)
' Fax a file to a fax number
' Uses the standard Windows NT/2000/XP FaxServer on the named Server
' David McReynolds, Aug 2003
' [email]d.mcreynolds@btinternet.com[/email]
Dim FaxServer As Object
Dim FaxDoc As Object
Dim retCode As Long
Set FaxServer = CreateObject("FaxServer.FaxServer", FaxServerName)
FaxServer.Connect FaxServerName
Set FaxDoc = FaxServer.CreateDocument(FileName)
With FaxDoc
.FaxNumber = FaxNumber
retCode = .Send
End With
MsgBox "Result of FaxDoc Send: " & retCode
Set FaxDoc = Nothing
FaxServer.Disconnect
Set FaxServer = Nothing
End Sub
------------------------
To use this:
Fax "c:\some file i want faxing.txt", "12345 678901", "NameOfComputerWithFaxServerOnIt"
Hope this helps...it works on my standalone system...
Är klient och server samma maskin i ditt fall? Annars lär du behöva tänka på att FileName är en giltig UNC-sökväg relativt servern och att det inte finns några rättighetsproblem.
Nu har jag fått det att funka. Fungerar iof bara att skicka tif-filer.
Men annars ganska smidigt.
Någon som vet hur man kan skapa tif-filer smidigt.
Om någon kommer på ett sätt att faxa annat än tif-filer blir jag glad om ni skriver hur.
Public Sub Fax(ByVal FileName As String, ByVal FaxNumber As String, ByVal FaxServerName As String)
' Fax a file to a fax number
' Uses the standard Windows NT/2000/XP FaxServer on the named Server
' David McReynolds, Aug 2003
' [email]d.mcreynolds@btinternet.com[/email]
Dim FaxServer As Object
Dim FaxDoc As Object
Dim retCode As Long
FileName = FileName
Set FaxServer = CreateObject("FaxServer.FaxServer", FaxServerName)
FaxServer.Connect FaxServerName
Set FaxDoc = FaxServer.CreateDocument(FileName)
With FaxDoc
.FaxNumber = FaxNumber
retCode = .Send
End With
MsgBox "Result of FaxDoc Send: " & retCode
Set FaxDoc = Nothing
FaxServer.Disconnect
Set FaxServer = Nothing
End Sub
Private Sub Command1_Click()
Call Fax("c:\test.tif", "00708200105", "pontus")
End Sub
Om någon kommer på ett sätt att faxa annat än tif-filer blir jag glad om ni skriver hur.
Inte för att det egentligen angår mig men: Vad händer när du försöker skicka en *.txt eller *.doc? Om det funkar när du droppar samma dokument på fax-skrivaren så borde det väl funka i kod också, tycker man? Du har Word installerat?