Need VBA Code to send a single FAX to multiple recipients

I'm wondering if there is a way in VBA to send a single fax to a string of fax numbers - as opposed to looping and sending multiple faxes out. I can't seem to get the syntax to work. Any ideas?
Eileen MurphyIndependent Application DeveloperAsked:
Who is Participating?
Eileen MurphyConnect With a Mentor Independent Application DeveloperAuthor Commented:
"[Fax: ##########]";"[Fax:##########]"; "[Fax: ##########]";"[Fax:##########]";
is the solution - substitute the string of # with the phone numbers and it works just dandy.
Eileen MurphyIndependent Application DeveloperAuthor Commented:
I just tested this further and if I don't use the .SEND command and rather use the .DISPLAY - then when I click in the Bcc line where the string of phone numbers (I pass from VBA) is displayed, the phone numbers get underlined and seem to be accepted as legitimate phone numbers. If I don't click in the Bcc line and the phone numbers don't get underlined, I get the same error as before: "Outlook does not recognize one or more names..."
Below is my code:

Public Function SendFaxesTEST()
On Error GoTo err_SendFaxesTEST
Err.Number = 0
Dim x

Dim olNs As Outlook.NameSpace
Dim theReport As String, theMsg As String
Dim olapp As New Outlook.Application
Dim olappMsg As Outlook.MailItem
Dim FaxNo As String, FaxTo As String, TheJob As String, TheDate As String, TheTime As String, BidsDueDate As Date, BidsDueTime As String, FromCo As String, theFax As String
Dim SendBidsTo As String, CoFax As String, FaxMemo As String, SentBy As String, InviteDate As Date, FaxString As String, z As String
Dim db As DAO.Database
Dim maillist As DAO.Recordset
Set olNs = olapp.GetNamespace("MAPI")
Set db = CurrentDb()
Set maillist = db.OpenRecordset("qryFaxRecipients") 'based on tempRecipients table...
    Do Until maillist.EOF
        FaxNo = "1" & maillist("FaxNumber")
        FromCo = maillist("CompanyName")
        FaxTo = maillist("Company") & " - " & maillist("ContactPerson")
        FaxString = FaxNo & ";" & FaxString            
    z = Len(FaxString) - 1
    FaxString = Left(FaxString, z) 'strip the last semi-colon
    TheJob = Forms!BidMaster!JobName & " " & Nz(Forms!BidMaster!EstDescription)
    InviteDate = Forms!BidMaster!JobSiteMeetingInviteDate
    TheDate = Nz(Forms!BidMaster!JobSiteMeetingDate, "T.B.D.")
    TheTime = Nz(Forms!BidMaster!JobSiteMeetingTime, "")
    BidsDueDate = Forms!BidMaster!BidDueFromSubsDate
    BidsDueTime = Forms!BidMaster!BidDueFromSubsTime
    SendBidsTo = Nz(DLookup("BidContact", "Companies", "CompanyID" = Forms!switchboard!coAccess), "")
    theFax = Nz(DLookup("CompanyFax", "Companies", "CompanyID" = Forms!switchboard!coAccess), "")
    CoFax = Left(theFax, 3) & "-" & Mid(theFax, 4, 3) & "-" & Right(theFax, 4)
    If FaxString <> "1" Then
        Set olappMsg = olapp.CreateItem(olMailItem)
        With olappMsg
            .BCC = FaxString
            .Subject = "REMINDER TO BID JOB"
            .Body = "To: " & FaxTo & Chr(10) & Chr(10) & "From: " & FromCo & Chr(10) & Chr(10) & "RE: On " & InviteDate & " you were invited to and AGREED to Submit a Bid for Project Name: " & TheJob & Chr(10) & Chr(10) & "Bids are Due: " & BidsDueDate & " at: " & BidsDueTime & "." & Chr(10) & Chr(10) & "Send Bids to: " & SendBidsTo & "  or Fax to: " & CoFax & Chr(10) & Chr(10) & UCase(FaxMemo) & Chr(10) & Chr(10) & "PLEASE SUBMIT YOUR BID BY " & BidsDueDate & "." & Chr(10) & Chr(10) & "Thanks " & SendBidsTo
            .Importance = olImportanceHigh
        End With
    End If
    Set olappMsg = Nothing
    Set maillist = Nothing
    Set db = Nothing
    If Err.Number = 0 Then Exit Function
    MsgBox "Error " & Err.Number & vbCrLf & Err.Description
    Resume exit_SendFaxesTEST

End Function

Cloud Class® Course: CompTIA Healthcare IT Tech

This course will help prep you to earn the CompTIA Healthcare IT Technician certification showing that you have the knowledge and skills needed to succeed in installing, managing, and troubleshooting IT systems in medical and clinical settings.

Eileen MurphyIndependent Application DeveloperAuthor Commented:
The previous question was also mine - however, this is a different issue. I attached a .pdf with screen shots of what I'm referring to here. Any help would be appreciated!
I know that - most viewers coming to this thread won't - that's why I posted it.
Eileen MurphyIndependent Application DeveloperAuthor Commented:
I see. Okay.
What about:

           .Importance = olImportanceHigh
           .BCC.setfocus '<-  doing something here equivalent to a click?? - before or after .Display??
       End With
Eileen MurphyIndependent Application DeveloperAuthor Commented:
Nope :(
"Invalid Qualifer" error message - both before and after .Display.
Good thinking though..
Eileen MurphyIndependent Application DeveloperAuthor Commented:
I did some more research and it appears that the fax number is not being "resolved" by Outlook - it's a term that appears to be farely common. One way around it is to add the fax number to the Contacts table and force it to be "resolved" - not a good solution for me.
Any ideas out there?
I'm sorry I do not used Outlook to send FAXes, so I'm up a blind alley.  As to 'resolving' I do not believe you need a contact to be in the Contacts list for that contact to be in BCC.  However, this FAX component may change a few of the rules.  It just may be worth adding a new folder FaxNumbers to the Contacts folder and add them all at one shot.  I imagine just two fields are all that's required, the number and a name.
Eileen MurphyIndependent Application DeveloperAuthor Commented:
I am going to test sending a string like: "[Fax: ##########]";"Fax:##########]"; etc. I think that may force Outlook to resolve the number... will keep you posted.
Great, award yourself the points as you seem to have found the answer.  Good to know!
Eileen MurphyIndependent Application DeveloperAuthor Commented:
:) Thank you, as always, for your help. I hope this helps someone in the future. I LOVE THIS SITE!
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.