I have been using Elastix for some time now, and happy to contribute back.
Like many, I did not use the fax service as I need all coming faxes to be printed and failed to find a viable solution.
Few days ago I have realised that I was looking at the problem from the wrong point of view, as it is far easier to have Elastix fax do it intended job sending the fax as an email attachment, and have the fax automaticaly printed at the outlook side.
enclosed is a sample of doing just that using outlook's VBA found at www.vboffice.net/sample.html?mnu=2&l...p=3&cmd=showitem Which I have tweeked a bit to have the email deleted after sucessful print.
Private Declare Function ShellExecute Lib "shell32.dll" Alias _
"ShellExecuteA" (ByVal hwnd As Long, ByVal lpOperation As String, _
ByVal lpFile As String, ByVal lpParameters As String, _
ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long
Private WithEvents Items As Outlook.Items
Private Sub Application_Startup()
Dim Ns As Outlook.NameSpace
Dim Folder As Outlook.MAPIFolder
Set Ns = Application.GetNamespace("MAPI")
Set Folder = Ns.GetDefaultFolder(olFolderInbox)
Set Items = Folder.Items
End Sub
Private Sub Items_ItemAdd(ByVal Item As Object)
If TypeOf Item Is Outlook.MailItem Then
If PrintAttachments (Item) then Item.Delete
End If
End Sub
Private function PrintAttachments(oMail As Outlook.MailItem) as Boolean
On Error Resume Next
Dim colAtts As Outlook.Attachments
Dim oAtt As Outlook.Attachment
Dim sFile As String
Dim sDirectory As String
Dim sFileType As String
sDirectory = "c:\Attachments\"
Set colAtts = oMail.Attachments
If colAtts.Count Then
For Each oAtt In colAtts
sFileType = LCase$(right$(oAtt.FileName, 4))
Select Case sFileType
Case ".pdf"
sFile = sDirectory & oAtt.FileName
oAtt.SaveAsFile sFile
If (ShellExecute 0, "print", sFile, vbNullString, vbNullString, 0) > 32 then
PrintAttachments = True
Else
PrintAttachments = False
End If
End Select
Next
End If
End Sub
Hope this may help.
Erez
trent richardson robert griffin iii dontari poe space shuttle nyc monkeypox nick perry 30 rock live
No comments:
Post a Comment