Attach multiple reports to GroupWise e-mail

BJS

Registered User.
Local time
Today, 19:01
Joined
Aug 29, 2002
Messages
109
I need to attach multiple reports (.rtf documents) to an e-mail that is being sent to multiple recipients.

Does anyone know how to automate this with Access 2000 and GroupWise Version 5.5 e-mail?

Thanks,
BJS
 
O.K....I found a sample database that attaches multiple documents to Groupwise e-mail. I've tested it, and that part works great.

Now I have a problem getting more than one recipients name in the e-mail. The code uses an Array...I'm not too swift with those. Here is the code, maybe someone can help:

Sub RunDemo()
'this is a sample usage routine
On Error GoTo Err_Handler
Dim strTemp As String
Dim varAttach(2) As Variant
Dim strRecTo(1, 0) As String

Dim lngCount As Long
Dim varProxies As Variant
Dim cGW As GW

varAttach(0) = "d:\Test.doc"
varAttach(1) = "d:\Test2.doc"
varAttach(2) = "d:\Test3.doc"

'HERE IS THE PART I'M HAVING TROUBLE WITH.
'WHEN I TYPE AN E-MAIL ADDRESS IN EACH OF THE strRecTo
'QUOTATIONS, IT ONLY SENDS THE E-MAIL TO THE FIRST
'RECIPIENT.

strRecTo(0, 0) = "foo@foo.invalid"
strRecTo(1, 0) = "Full Name 1"

Set cGW = New GW
With cGW
.Login
.BodyText = "Test E-mail"
.Subject = "Test"
.RecTo = strRecTo
.FileAttachments = varAttach
.FromText = "Your Boss"
.Priority = "High"
strTemp = .CreateMessage
.ResolveRecipients strTemp
If IsArray(.NonResolved) Then MsgBox "Some unresolved recipients."
.SendMessage strTemp
.DeleteMessage strTemp, True
End With

Exit_Here:
Set cGW = Nothing
Exit Sub

Err_Handler:
MsgBox "Error " & Err.Number & ": " & Err.Description, vbCritical
Resume Exit_Here

End Sub

PLEASE HELP....AND THANKS!!!
 
Well, I never tried to sent E-Mail to multiple users via access ...
but when I look at the code it seems that

strRecTo(0, 0) = "foo@foo.invalid"

simply enters "foo@foo.invalid" into the "to" field. My idea would be to enter "foo@foo.invalid;foo2@...;foo3;". If this doesnt work, you could try:

strRecTo(0, 0) = "foo@foo.invalid"
strRecTo(0, 1) = "foo2@foo.invalid"
strRecTo(0, 2) = "foo3@foo.invalid"

Hope this works!
Bye!
-Michael
 
Thanks Michael, I did try that, but it didn't work for me.
BUT....I got it to read the e-mail recipients names from a table, and assigned those names to a variable. My program now works! It creates a single e-mail, with multiple recipients and attaches multiple documents. Here is my modified code:

On Error GoTo Err_Handler

DoCmd.OutputTo acOutputReport, "Report1", acFormatRTF, "d:\Test1.doc"
DoCmd.OutputTo acOutputReport, "Report2", acFormatRTF, "d:\Test2.doc"
DoCmd.OutputTo acOutputReport, "Report3", acFormatRTF, "d:\Test3.doc"

Dim strTemp As String
Dim varAttach(2) As Variant
Dim strRecTo(1, 0) As String

Dim lngCount As Long
Dim varProxies As Variant
Dim cGW As GW

varAttach(0) = "d:\Test1.doc"
varAttach(1) = "d:\Test2.doc"
varAttach(2) = "d:\Test3.doc"


Dim dbs As Database, rst As Recordset, idx As Index
Dim tr As String, tb As String, stDocName As String
Dim dbs1 As Database

Set dbs1 = DBEngine.Workspaces(0).OpenDatabase("D:\TestDatabase\Test_be.mdb")
Set rst = dbs1.OpenRecordset("Tbl_E-mail")

rst.Index = "AccRpt"
With rst
Do While Not rst.EOF
tb = Nz(!AccRpt)
If tb = "zz" Then
Exit Do
Else
tr = tr & "; "
If tr = "; " Then
tr = ""
End If
End If
tr = tr & !AccRpt
rst.MoveNext
Loop
End With
dbs1.Close

strRecTo(0, 0) = tr

Set cGW = New GW
With cGW
.Login
.BodyText = "See the attached reports."
.Subject = "Reports"
.RecTo = strRecTo
.FileAttachments = varAttach
.FromText = ""
.Priority = "High"
strTemp = .CreateMessage
.ResolveRecipients strTemp
If IsArray(.NonResolved) Then MsgBox "Some unresolved recipients."
.SendMessage strTemp
.DeleteMessage strTemp, True
End With

Kill "d:\Test1.doc"
Kill "d:\Test2.doc"
Kill "d:\Test3.doc"

Exit_Here:
Set cGW = Nothing
Exit Sub

Err_Handler:
MsgBox "Error " & Err.Number & ": " & Err.Description, vbCritical
Resume Exit_Here
 

Users who are viewing this thread

Back
Top Bottom