Emailing a report

Hudson

New member
Local time
Yesterday, 20:53
Joined
May 2, 2011
Messages
9
Right easy one for all you genius'sout there. New to access 2007 so here we go. How do you run a macro to email a report without getting the error message 'No profiles have been created'...'the password is invalid'. PS I'm running the macro SendObject.
 
This code will open up your outlook (dont forget to add the refrence) if it is not already running. Im not sure if this will help you or not.



Code:
        Dim bStarted As Boolean
        Dim oOutlookApp As Outlook.Application
        Dim oItem As Outlook.MailItem
                
        On Error Resume Next
        
        'Get Outlook if it's running
        Set oOutlookApp = GetObject(, "Outlook.Application")
            If Err <> 0 Then
                'Outlook wasn't running, start it from code
                Set oOutlookApp = CreateObject("Outlook.Application")
                bStarted = True
            End If
        
        'Create a new mailitem
        Set oItem = oOutlookApp.CreateItem(olMailItem)
 

Users who are viewing this thread

Back
Top Bottom