Results 1 to 4 of 4

Thread: [RESOLVED] Access 2000 Email via groupwise

  1. #1

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2001
    Location
    Washington DC
    Posts
    330

    Resolved [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.

  2. #2
    Superbly Moderated NeedSomeAnswers's Avatar
    Join Date
    Jun 2002
    Location
    Manchester uk
    Posts
    2,660

    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



  3. #3

    Thread Starter
    Hyperactive Member
    Join Date
    Aug 2001
    Location
    Washington DC
    Posts
    330

    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.

  4. #4
    Superbly Moderated NeedSomeAnswers's Avatar
    Join Date
    Jun 2002
    Location
    Manchester uk
    Posts
    2,660

    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
  •  



Click Here to Expand Forum to Full Width