VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Fax

by Bazzapr (2 Submissions)
Category: OLE/COM/DCOM/Active-X
Compatability: Visual Basic 5.0
Difficulty: Advanced
Date Added: Wed 3rd February 2021
Rating: (4 Votes)

I was looking for code to fax on VBC. found some fax stuff but people had some problems. Hopefully this solves it. It worked for me. Put this code in a Class Module.

Rate Fax

Private Declare Function GetComputerName Lib "kernel32" Alias "GetComputerNameA" (ByVal lpBuffer As String, nSize As Long) As Long
Public Function Fax(ByVal FileName As String, ByVal FaxNumber As String)
Dim FaxServer As Object
Dim FaxDoc As Object
Dim ComputerName As String
  ComputerName = String(50, Chr(0))
  Call GetComputerName(ComputerName, 50)
  ComputerName = Trim(Replace(ComputerName, Chr(0), ""))
  
  Set FaxServer = CreateObject("FaxServer.FaxServer")
  FaxServer.Connect ("\\" & ComputerName)
  
  Set FaxDoc = FaxServer.CreateDocument(FileName)
  With FaxDoc
    .FaxNumber = FaxNumber
    .Send
  End With
   
  
  Set FaxDoc = Nothing
  Set FaxServer = Nothing
End Function

Download this snippet    Add to My Saved Code

Fax Comments

No comments have been posted about Fax. Why not be the first to post a comment about Fax.

Post your comment

Subject:
Message:
0/1000 characters