Hi I'm using Groupwise 6.5 and I have the following VBA code to create a
new message, add recipients, subject, message and attachments. Everything
works except for attachments. Even though executing the ItemAttachmentAdd
code returns a 1 which indicates a success, there are no attachments on
the email. I did a search on Novell and it seems there was a reported bug
for this function in Groupwise 5.2 and I was wondering whether the same
problem still applies for 6.5 or whether I've just forgotten something.

Thanks in advance for your help.

The code below shows a sub TestEmail that calls a helper function

Public Sub TestEmail()
Dim recipients As Collection
Set recipients = New Collection
recipients.Add "Recipient 1"
recipients.Add "Recipient 2"

Dim attachmentPaths As Collection
Set attachmentPaths = New Collection
attachmentPaths.Add "c:/PkgClnup.log"

Dim emailSent As Boolean
emailSent = SendEmail("Testing body", "Testing subject", recipients,

End Sub

Public Function SendEmail(ByVal BodyText As String, ByVal SubjectText As
String, _
ByVal recipients As Collection, ByVal
attachmentPaths As Collection) _
As Boolean
On Error GoTo Error_Exit

Dim iRet As Integer
Dim sResult As String
Dim MyMsgID As String
Dim ParamStr As String

'Open the Groupwise Email
Dim vCommander As Object
Set vCommander = CreateObject("GroupWiseCommander")
MyMsgID = "X00"

'This opens up a brand new mail message
sResult = ""
iRet = vCommander.Execute("ViewOpen(276)", sResult)
If iRet = 0 Then
MsgBox "Email could not be created, please make sure that
Groupwise client is open.", vbExclamation, "Email Error"
SendEmail = False
Exit Function
End If

'This sets the TO field (see token documention - ItemSetText)
Dim sendTo As String
Dim recipient As Variant
Dim recipientCount As Integer
recipientCount = 1
For Each recipient In recipients
If recipientCount = 1 Then
ParamStr = "ItemSetText(""" + MyMsgID + """;0;""" + CStr
(recipient) + """)"
iRet = vCommander.Execute(ParamStr, sResult)

Else 'More than 1 recipient
ParamStr = "ItemSetText(""" + MyMsgID + """;0;""" + CStr
(recipient) + """;" + recipientCount + ")"
iRet = vCommander.Execute(ParamStr, sResult)
End If

'Sets attachments
Dim fileName As Variant
For Each fileName In attachmentPaths
ParamStr = "ItemAttachmentAdd(""" + MyMsgID + """;114;""" + CStr
(fileName) + """;""" + fileName + """)"
iRet = vCommander.Execute(ParamStr, sResult)

'Add a subject
ParamStr = "ItemSetText(""" + MyMsgID + """;9;""" + SubjectText + """)"
iRet = vCommander.Execute(ParamStr, sResult)

ParamStr = "ItemSetText(""" + MyMsgID + """;10;""" + BodyText + """)"
iRet = vCommander.Execute(ParamStr, sResult)

SendEmail = True
Exit Function

MsgBox Err.Description, vbExclamation, "Email Error"
SendEmail = False

End Function