-
Sep 2nd, 2008, 08:00 AM
#1
Thread Starter
Hyperactive Member
[RESOLVED] Access 2000 Email via groupwise
I am trying to send an email via Groupwise from Access 2000 adding an attachment of an Access report in rtf format. It is not recognizing or locating the attachment.
I am using the following code:
Code:
Public Sub Email_Via_Groupwise(sLoginName As String, _
sEmailTo As String, _
sSubject As String, _
sBody As String, _
Optional sAttachments As String, _
Optional sEmailCC As String, _
Optional sEmailBCC As String)
'Author : Ken Puls (www.excelguru.ca)
'Macro purpose: To stand as a self contained procedure for creating and
' sending an email via groupwise
'NOTE: You can feed a comma separated string of address to all
' address and attachment fields
On Error GoTo EarlyExit
'Required variable declarations
Const NGW$ = "NGW"
Dim ogwNewMessage As GroupwareTypeLibrary.Mail
Dim aryTo() As String, _
aryCC() As String, _
aryBCC() As String, _
aryAttach() As String
Dim lAryElement As Long
'sAttachments = vbNullString
'Split the emails into an array if necessary
aryTo = Split(sEmailTo, ",")
aryCC = Split(sEmailCC, ",")
aryBCC = Split(sEmailBCC, ",")
aryAttach = Split(sAttachments, ",")
'Set application object reference if needed
'Application.StatusBar = "Logging in to email account..."
If ogwApp Is Nothing Then
DoEvents
Set ogwApp = CreateObject("NovellGroupWareSession")
DoEvents
End If
'Login to root account if required
If ogwRootAcct Is Nothing Then
Set ogwRootAcct = ogwApp.Login(sLoginName, vbNullString, _
, egwPromptIfNeeded)
DoEvents
End If
'Create new message
'Application.StatusBar = "Building email to " & sEmailTo & "..."
Set ogwNewMessage = ogwRootAcct.WorkFolder.Messages.Add _
("GW.MESSAGE.MAIL", egwDraft)
DoEvents
'Assign message properties
With ogwNewMessage
'To field
For lAryElement = 0 To UBound(aryTo())
.Recipients.Add aryTo(lAryElement), NGW, egwTo
Next lAryElement
'CC Field
For lAryElement = 0 To UBound(aryCC())
.Recipients.Add aryCC(lAryElement), NGW, egwCC
Next lAryElement
'BCC Field
For lAryElement = 0 To UBound(aryBCC())
.Recipients.Add aryBCC(lAryElement), NGW, egwBC
Next lAryElement
'Subject & body
.Subject = sSubject
.Bodytext = sBody
'Attachments (if any)
For lAryElement = 0 To UBound(aryAttach())
If Not aryAttach(lAryElement) = vbNullString Then _
.Attachments.Add aryAttach(lAryElement)
Next lAryElement
'Send the message (Sending may fail if recipients don't resolve)
On Error Resume Next
.Send
DoEvents
'If Err.Number = 0 Then Application.StatusBar = "Message sent!" _
' Else: Application.StatusBar = "Email to " & sEmailTo & " failed!"
On Error GoTo 0
End With
EarlyExit:
'Release all variables
Set ogwNewMessage = Nothing
Set ogwRootAcct = Nothing
Set ogwApp = Nothing
DoEvents
'Application.StatusBar = False
End Sub
Any suggestions?
Swoozie
Somedays you just should not get out of bed.
-
Sep 2nd, 2008, 09:55 AM
#2
Re: Access 2000 Email via groupwise
2 questions ?
1, What do you mean it is not recognising or locating the attachment ? i.e is the code actually sending the email without an attachment ?
When you debug the code does it actually add an attachment on the line -
Code:
.Attachments.Add aryAttach(lAryElement)
and this seems to work properly but no attachment is sent?
2, Is the attachment you are trying to send on the same machine or server as your access application ?
Please Mark your Thread "Resolved", if the query is solved & Rate those who have helped you
-
Sep 2nd, 2008, 10:06 AM
#3
Thread Starter
Hyperactive Member
Re: Access 2000 Email via groupwise
It sends the email with out the attachment.
When I debug, it assigned the file name to the variable but nothing happens after that with regards to the attachment
Swoozie
Somedays you just should not get out of bed.
-
Sep 2nd, 2008, 10:48 AM
#4
Re: Access 2000 Email via groupwise
And is the attachment on the same server / PC as the access application ?
Please Mark your Thread "Resolved", if the query is solved & Rate those who have helped you
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|