sendobject macro not working in access 2013

henrikped10

New member
Local time
Today, 14:00
Joined
Sep 8, 2015
Messages
1
Hi.

I have an access database made in access 2007. I use this database to send emails via outlook using sendobject macro.

After I have upgraded to office 2013, I cant use this sendobject anymore. I get an error 2293. Also, when I try to open the macro in design view, access closes down (stops working).

So I guess office 2013 has made some changes to the way sendobject is handled.

Is there a way to solve this problem?

I dont know how to use vba coding, so I am hoping for a solution via macro.

Thanks.
 
Since this is a converted db, try building a new 2013 db (with just 1 form) and try using the sendObject command in a new native 2013 db.

If that fails, then Access has truly failed us.
you can try this below:
create a new module,
in the module paste the code below,

usage:
Code:
sub btnSend_Click()\
vSuccess = Email1("rick.grimes@TWD.com","subject", "body text", "c:\folder\file.zip")

end sub

'-------------
Public Function Email1(ByVal pvTo, ByVal pvSubj, ByVal pvBody, optional ByVal pvFile) As Boolean
'-------------
Dim oApp As Outlook.Application
Dim oMail As Outlook.MailItem
On Error GoTo ErrMail

    'NOTE  BE SURE YOU ADD OUTLOOK APP VIA  VBE menu:TOOLS, REFERENCES

Set oApp = CreateObject("Outlook.Application")
Set oMail = oApp.CreateItem(olMailItem)

With oMail
    .To = pvTo
    .Subject = pvSubj
    .Body = pvBody
    
    if not isempty(pvFile) then  .Attachments.Add pvFile, olByValue, 1
    .Send
End With

Email1 = True
endIt:
Set oMail = Nothing
Set oApp = Nothing
Exit Function

ErrMail:
MsgBox Err.Description, vbCritical, Err
Resume endit
End Function
 
I have been having the same problem! My database was made in 2013 with (I think) Access 2010. I have a series of macos that use EMailDatabaseObject. Recently I upgraded to Access 365 which I assume is the same as Access 2013, but I get the error message 2293. I first tried just copying the macro and then running the copy, same problem. Then I created a new macro in the same dbase, same problem. My dbase is for a club and creates an invoice then emails it in pdf to individual members. so creating a new dbase is a big job which I really don't want to do, I also, have a limited knowledge of using VBA with Access, so can you give some instructions, please, on where and how we copy the code above into the existing database.

Sorry for "hijaking" this post, but as I have the same problem i thought it would be better adding to the conversation than starting a new post.
 
in the MODULES area, create a new module, CREATE, MODULE
paste this code in it. save.

the click part (below) goes in a form in a button event, when clicked, sends the email

sub btnSend_Click()
vSuccess = Email1("rick.grimes@TWD.com","subject", "body text", "c:\folder\file.zip")
end sub
 
Thanks for your reply. I need to send a report (which is actually an invoice made by the dbase). With EMailDatabaseObject I was able to convert the report to pdf, then email that. With the code above, I assume it emails the file that is "c:\folder\file.zip" as an attachment so to get this to work I would need to first save the report as a pdf in "C:\folder\", is that correct?
 

Users who are viewing this thread

Back
Top Bottom