Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Outlook / Interop / February 2004

Tip: Looking for answers? Try searching our database.

Sending fax from VBA

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
John Galt - 04 Feb 2004 06:45 GMT
Does anyone have working code to send a fax from VBA using Outlook.Mailitem?
I have tried some examples I have found and they all simply try to use the
Fax number as an e-mail address.

Thanks in advance
Sue Mosher [MVP] - 04 Feb 2004 13:12 GMT
That's the standard, generic method unless you are using fax software that
has its own API.
Signature

Sue Mosher, Outlook MVP
Author of
    Microsoft Outlook Programming - Jumpstart for
    Administrators, Power Users, and Developers
    http://www.outlookcode.com/jumpstart.aspx

> Does anyone have working code to send a fax from VBA using Outlook.Mailitem?
> I have tried some examples I have found and they all simply try to use the
> Fax number as an e-mail address.
>
> Thanks in advance
John Galt - 04 Feb 2004 15:42 GMT
Sue here is the code I have.  Do you see any issues with it?

Private Sub cmdSendFax_Click()
Dim objOutlook As New Outlook.Application
Dim objOutlookMsg As Outlook.MailItem
Dim TelNo As String

TelNo = "18887498870" '

'Create a mail item.
Set objOutlookMsg = objOutlook.CreateItem(olMailItem)
   With objOutlookMsg
       .To = "[Fax: " & TelNo & "]"
       .Subject = "SUBJECT LINE GOES HERE"
       .Body = "To Mr. XYZ" & Char(10) & " This is an Automated
Transmission from the computer." & Char(10) & "Send Fax Completed." &
Char(10) & "------ End of Doc ------"
       .Importance = olImportanceHigh
       .Attachments.Add ("C:\windows\win.ini") 'Pathname+filename with ext
       .Send
    End With
Set objOutlookMsg = Nothing

End Sub

> That's the standard, generic method unless you are using fax software that
> has its own API.
[quoted text clipped - 4 lines]
> >
> > Thanks in advance
Sue Mosher [MVP] - 04 Feb 2004 16:22 GMT
Looks fine, assuming that you have a fax component in the current Outlook
setup that supports the standard [FAX:number] syntax. You never said what
fax software you're using.
Signature

Sue Mosher, Outlook MVP
Author of
    Microsoft Outlook Programming - Jumpstart for
    Administrators, Power Users, and Developers
    http://www.outlookcode.com/jumpstart.aspx

> Sue here is the code I have.  Do you see any issues with it?
>
[quoted text clipped - 30 lines]
> > >
> > > Thanks in advance
John Galt - 04 Feb 2004 18:35 GMT
I am using the microsoft fax that comes with Outlook or XP.
I can print to the fax from other applications but the " .to = FAX: etc..."
only treats the phone number as an e-mail address.

> Looks fine, assuming that you have a fax component in the current Outlook
> setup that supports the standard [FAX:number] syntax. You never said what
[quoted text clipped - 35 lines]
> > > >
> > > > Thanks in advance
Sue Mosher [MVP] - 04 Feb 2004 22:36 GMT
Since Outlook 2002 doesn't include any fax component, I'm not sure what
you're referring to.

Printing to a fax printer doesn't count. The component has to be able to
send to a fax recipient.
Signature

Sue Mosher, Outlook MVP
Author of
    Microsoft Outlook Programming - Jumpstart for
    Administrators, Power Users, and Developers
    http://www.outlookcode.com/jumpstart.aspx

> I am using the microsoft fax that comes with Outlook or XP.
> I can print to the fax from other applications but the " .to = FAX: etc..."
[quoted text clipped - 41 lines]
> > > > >
> > > > > Thanks in advance
John Galt - 05 Feb 2004 16:08 GMT
The Fax component is the Fax Mail Transport.
I set it up as an e-mail account in Outlook.

I eventually did figure it out.  The problem is that the fax number MUST be
in the format +1 (555) 555-1212 (with spaces dashes and parens).  The
outlook will not invoke the fax transport w/o the number being precisely
formatted. (Pretty poor design but...)

> Since Outlook 2002 doesn't include any fax component, I'm not sure what
> you're referring to.
[quoted text clipped - 51 lines]
> > > > > >
> > > > > > Thanks in advance
Sue Mosher [MVP] - 05 Feb 2004 19:26 GMT
"Fax Mail Transport" doesn't tell us much, does it? Maybe it's the WinFax SE
component? Maybe it's the Windows XP component? I sure don't know from the
name.

Anyway, most fax components need the number to be in good canonical format
in order to know how to apply the Windows dialing rules. But your mileage
may vary with different components.

Signature

Sue Mosher, Outlook MVP
Author of
    Microsoft Outlook Programming - Jumpstart for
    Administrators, Power Users, and Developers
    http://www.outlookcode.com/jumpstart.aspx

> The Fax component is the Fax Mail Transport.
> I set it up as an e-mail account in Outlook.
[quoted text clipped - 52 lines]
> > > > that
> > > > > > has its own API.

> > > > > > > Does anyone have working code to send a fax from VBA using
> > > > > > Outlook.Mailitem?
[quoted text clipped - 5 lines]
> > > > > > >
> > > > > > > Thanks in advance
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.