Fax Software

Community Forums

#4315

manciaux
Member

I had the same problem. This program seems to work

Public Sub SaveFaxFile(strTargetFile As String)

Dim oLog As Object ‘wfxctl32.CSDKLog
Dim oConverter As Object ‘ wfxctl32.CSDKFXConverter
Dim strFolderName As String
Dim strFolderID As String
Dim strMessageID As String
Dim strFileName() As String
Dim strFilePath As String
Dim strFileID As String
Dim intPage As Integer
Dim varResult As Variant

Dim intTargetFolder As Integer

Const STANDARDFOLDER_WINFAX_OUTBOX = 6
Const STANDARDFOLDER_WINFAX_LOG = 2
Const STANDARDFOLDER_WINFAX_SENDLOG = 4

On Error GoTo SaveFaxFile_err

intTargetFolder = STANDARDFOLDER_WINFAX_SENDLOG
Const LogName = “Send Log”

Set oLog = CreateObject(“Winfax.SDKLog”)
Set oConverter = CreateObject(“Winfax.SDKFXConverter”)

‘ find the correct folder – iterate through the list since we can’t beu sure of the order
strFolderID = oLog.GetFolderListFirst(STANDARDFOLDER_WINFAX_LOG, “”)
Do Until (oLog.GetFolderDisplayName(strFolderID) = LogName) Or (strFolderID = “”)
strFolderID = oLog.GetFolderListNext
Loop

If oLog.GetFolderDisplayName(strFolderID) = LogName Then
‘ we get the first message (we are assuming the outbox has only 1 item in it
strMessageID = oLog.GetMessageListFirst(intTargetFolder, “”)
If (Len(strMessageID) > 0) Then
‘ get the file names and use the converter to add them to a multi-page fxs file
strFileName = Split(oLog.GetMessageFirstFile(strFolderID, strMessageID), “|”)
oConverter.Format = 10
oConverter.BitsPerPixel = 1
Do Until UBound(strFileName) 3
strFilePath = strFileName(1) & strFileName(0)
If Dir$(strFilePath) “” Then
intPage = intPage + 1
varResult = oConverter.ConvertFromFXToPage(strFilePath, strTargetFile, intPage)
Debug.Print varResult

End If
strFileName = Split(oLog.GetMessageNextFile(), “|”)
Loop
End If
End If

SaveFaxFile_Exit:
Exit Sub
SaveFaxFile_Error:
If oError.Handle(MY_NAME & “_” & “SaveFaxFile”) Then Stop: Resume
Resume SaveFaxFile_Exit
End Sub