Hi,
I thought I'd put it up on the site so that it's available to all who want it.
I used this to send out a whole bunch of Excel spreadsheets held in one directory all listed on Excel. (sent out 300 emails to varied recipients with varied subject, message and attachments in under 2 minutes.)
The macro is set up to handle up to two recipients and one Cc recipient, although again, that can be changed to suit your requirements. I had a system of file names which used two names:- strThisCC and strSheetName, you may want to ditch one!
Don't forget to add in the references to Groupwise using Tools References off the VBA menu.
Best of luck
Tiglet
Dim strThisCC
As String, strSheetName
As String
Dim Recipient
As String, subject
As String
Dim RecipientTwo
As String
Dim Cc_recipient
As String
Dim ChristianName
As String
Sub Directory_List()
Dim myRow
As Integer
Dim myFile
As String
'This Sub lists out all of the .xls files in the current
'directory. (You can change the directory by using the
'Chdir command and change the file extensions to .pdf in
'your code)
myRow = 1
myFile = Dir("*.xls"
Do Until myFile = ""
Cells(myRow, 1) = myFile
myRow = myRow + 1
myFile = Dir
Loop
End Sub
Sub Auto_email()
'
'Uses info on spreadsheet to send attachments to email recipients with subject line.
Do While True
strThisCC = ActiveCell.Value
If strThisCC = ""
Then Exit Sub
ActiveCell.Offset(0, 1).Activate
'move to next column
Recipient = ActiveCell.Value
ActiveCell.Offset(0, 1).Activate
'move to next column
RecipientTwo = ActiveCell.Value
ActiveCell.Offset(0, 1).Activate
'move to next column
Cc_recipient = ActiveCell.Value
ActiveCell.Offset(0, 1).Activate
'move to next column
subject = ActiveCell.Value
ActiveCell.Offset(0, 1).Activate
'move to next column
ChristianName = ActiveCell.Value
strSheetName = strThisCC & "_Bud_04.xls"
'sets full file name
Call Email_Send
ActiveCell.Offset(1, -5).Activate
'takes you back to the next file name in list
Loop
End Sub
Function Email_Send()
Dim GWApp
As Object
Dim gWAccount
As Account
'Open a GroupWare session Object
Set GWApp = CreateObject ("NovellGroupWareSession"
'login to GW
'Login using () will login to the open account or run the
'login script if none was opened.
Set gWAccount = GWApp.Login()
'Create a new message in the Mailbox
Set gwmessage = gWAccount.MailBox.Messages.Add
gwmessage.BodyText = ChristianName & Chr(10) & Chr(10) "Enter Body Text Here"
'The above '& Chr(10)' etc is ASCII formatting for new lines
'etc
gwmessage.subject = subject
gwmessage.Recipients.AddByDisplayName Recipient
If RecipientTwo <> ""
Then gwmessage.Recipients.AddByDisplayName RecipientTwo
If Cc_recipient <> ""
Then gwmessage.Recipients.AddByDisplayName Cc_recipient, 1
gwmessage.Attachments.Add ("C:\Enter name of directory here\"

& strSheetName
'Add an open workbook to the attachments
gwmessage.send
'Send out
End Function