Hulp nodig met acces

Status
Niet open voor verdere reacties.

kinglex

Nieuwe gebruiker
Lid geworden
27 nov 2008
Berichten
1
Ik wil met de volgende tekst , meerdere tabellen automatisch door outlook laten verzenden. 1 tabel lukt me nog met onderstaande tekst, echter hoe krijg ik het voor elkaar meerdere bestanden in xls. in dezelfde email als attachment te verzenden.
alvast bedankt voor jullie hulp

Public Function runprocess()

'1 auto VOORWAARDEN
'2 TABEL COMPLEET
'3 NIET VERKOCHT VERKLAARDE AUTOS
'4 garantie label gewijzigd natl
'5 LK GEGEVENS NIET INGEVULD VOOR HUIDIGE DATUM
'7 auto VOORWAARDEN IN HANDEL
'Email

DoCmd.SetWarnings (False)
DoCmd.OpenQuery "1 auto VOORWAARDEN"
DoCmd.OpenQuery "2 TABEL COMPLEET"
DoCmd.OpenQuery "3 NIET VERKOCHT VERKLAARDE AUTOS"
DoCmd.OpenQuery "4 garantie label gewijzigd natl"
DoCmd.OpenQuery "5 LK GEGEVENS NIET INGEVULD VOOR HUIDIGE DATUM"
DoCmd.OpenQuery "7 auto VOORWAARDEN IN HANDEL"

Dim onderwerp As String
Dim tekst As String

onderwerp = "auto in af te leveren rapportage "
tekst = "zie bijlagen!" & vbCrLf & vbCrLf _
& "Met vriendelijke groet," & vbCrLf _
& "afzender" & vbCrLf _
& "helpdesk" & vbCrLf _
& "Tel: " & vbCrLf & vbCrLf

DoCmd.SendObject acSendQuery, "1 auto voorwaarden", acFormatXLS, "help@me.nl;", , , onderwerp, tekst, False

MsgBox "Process klaar"
 
Export your query's to spreadsheets and use the following function to send your mail:
Code:
Public Function GenerateMyMail(strTo As String, strSubject As String, strBody As String, Optional strCC As String = "", Optional strFiles As String = "", Optional blnPreview As Boolean = True) As Boolean
' By Guus2005 - 2008 version 1.0
' strTo     : To email adres (or use semicolon ; to separate multiple adresses)
' strCC     : optional, copy of mail to CC, default empty
' strSubject: Subject of the mail
' strBody   : Body of the mail
' strfiles  : optional, one or multiple by pipe | separated files
' blnPreview: optional, show a preview(true, default) or immediately send(false)
'
' You need a reference to Microsoft Outlook 11.0 Object Library (or different version)
'
    Dim appOL            As New Outlook.Application
    Dim olMail           As Outlook.MailItem
    Dim intTeller        As Integer
    Dim arrAttachments() As String
    
    'Assume Succes!
    GenerateMyMail = True
    
    On Error GoTo Err_GenerateMail
    
    'Create an array of attachments
    arrAttachments = Split(strFiles, "|")
    
    'Create mail item
    Set olMail = appOL.CreateItem(olMailItem)
    With olMail
        .To = strTo
        .CC = strCC
        .Subject = strSubject
        .Body = strBody
        'Add attachments
        For intTeller = 0 To UBound(arrAttachments)
            If Len(arrAttachments(intTeller)) > 0 Then
                .Attachments.Add arrAttachments(intTeller)
            End If
        Next intTeller
        If blnPreview Then
            .Display 'Display b4 you send it
        Else
            .Send 'Send message
        End If
    End With

Exit_GenerateMail:
    Exit Function
Err_GenerateMail:
    GenerateMyMail = False
    ' Use your own errorHandler
    ErrorProc Err, Error$, "GenerateMail", "modMail"
    Resume Exit_GenerateMail
End Function
HTH:D
 
Status
Niet open voor verdere reacties.
Terug
Bovenaan Onderaan