26. (Advanced Programming In Access 2013) Send Outlook Email With VBA

Поділитися
Вставка
  • Опубліковано 19 вер 2024
  • Send Outlook Email With VBA video in the "Advanced Programming in Microsoft Access 2013" series hosted by Steve Bishop. In this free advanced video tutorial series Steve will be going over Microsoft SQL Server installation, Database Migration, creating a better User Interface, using external data sources, complex Visual Basic For Applications (VBA) concepts and distributing your application.
    Click here for the full playlist of "Advanced Programming in Access 2013":
    • 1. (Advanced Programmi...
    Click here for the Work Files of this series:
    github.com/Xip...

КОМЕНТАРІ • 104

  • @freebird7556
    @freebird7556 2 роки тому

    I always thank to Steve.. for more than 5 years.. simple, easy, and get to direct point, and very kind instruction...

  • @freebird7556
    @freebird7556 2 роки тому

    Surely this is the very best instruction on email sending from Access!!!!!!!

  • @katrinasmith5108
    @katrinasmith5108 8 років тому +1

    I have looked everywhere for an email solution. This is great - you explain everything so well and best of it - it works!! Thanks heaps

  • @mividalocastudio9366
    @mividalocastudio9366 2 роки тому

    Dude you're a GENIUS! Thanks for this video.

  • @swapnilwankhede3440
    @swapnilwankhede3440 6 років тому

    Hi Steve
    Excellent Tutorials, Thanks a lot Steve for uploading this videos, it’s really helpful, never found such good videos.

  • @omg2mad4u
    @omg2mad4u 9 років тому

    Great vid Steve. Thanks for all your great stuff. I have watched all of it and look forward to each new one.

  • @sangaramedi
    @sangaramedi 7 років тому +3

    Hi Sir,
    i have error Run-time error '287: Application-defined or object-defined error. When I select "Debug"
    "send"
    .send

  • @havaljamal9952
    @havaljamal9952 3 роки тому

    Thank you so much for the comprehensive clarification, in the attachment section, how if we would to attached a report in the access itself, instead of selecting a file ??

  • @gsommers1
    @gsommers1 5 років тому

    Steve, these videos are incredibly helpful! I am very grateful. You reference another video where you show how to put a PDF inside of Access. Mind sharing a link? Thanks again, the amount of time you put into these videos shows, and thanks again for the great tutorials!

  • @shakey3258
    @shakey3258 9 років тому +1

    Thanks for the vid. Any chance on doing a vid on Incoming/received outlook emails = how to get them into Access...Keep up the great work. Really loved your howto on setting up an SQL server

  • @laarnidinu
    @laarnidinu 6 років тому

    Thank you Steve you've demonstrated the best! Could you please include a video on how to include the outlook signature at the end of the email and i'm thinking is it possible to grab the data from a report and paste in the body? Thanks so much for your help

  • @ehteshamshah
    @ehteshamshah 3 роки тому

    Dear do u plz tell me how to get data from electronic weigh machine to Access data base. Waiting for ur reply.

  • @johnchukwudi6146
    @johnchukwudi6146 7 років тому

    Hi Steve, thank you for your exposure in this topic.
    My question here is how can I send an email with one field hidden. That is, I want when I am sending an email from my Access App, the form should copy the mac address of the send without the knowledge of the sender.
    I just want whenever an email is sent to me, It should contain the MAC address of the sender to me without the knowledge of the sender. Is this possible?

  • @hanvu1951
    @hanvu1951 6 років тому

    Great video Steve. I just want to ask a stupid question could you please show how to add form1 with all the button browse, clear, and send. thanks

  • @dankirchner4460
    @dankirchner4460 3 роки тому

    Hello Sir. I know this is an older video so I hope you'll get this message. I took the form1 and put it in my DB. Im running access 2016 and seem to get a application defined or object defined error at the oEmail.send part of the code. Additionally I am using the adjusted code from video number 27 because I think it'll fit my needs best. Any change you can coach me through this?

  • @ssakthish1
    @ssakthish1 8 років тому

    Hello,I don't want to add the attachment, instead I want the data in the form (Including the Textbox & Label) to be generated in the body of the outlook with table format. Is that possible?

  • @simplestsofthazlosencillo3078
    @simplestsofthazlosencillo3078 3 роки тому

    How can I send an access report like an attachment with this code ?

  • @akashtribhuvan8124
    @akashtribhuvan8124 5 років тому

    I have created a data entry form with Subject line (Text), Email Body (Text) and an Ole Object box in which I paste the screen shot. Now on save button click, data gets added to the table and also drafts an email with the same subject line and email Body.
    ***CONCERN I am facing with the ole object IMAGE, which I want automatically to be in the email body below the text. Is there any way to do so, if not then any alternative or suggestions?

  • @andersonnwammadi7303
    @andersonnwammadi7303 6 років тому

    Great work Steve ! Please in what video did you create the Clear, Brows and Send button in the form?

  • @TheAnthonychalloner
    @TheAnthonychalloner 6 років тому

    Great work again Steve. Only wish is that you could take the integration of outlook further, like how to format the body text to allow inclusion of graphics and formatted text from perhaps a word template. I regularly send emails from within Access to club members using a store of pre-defined templates but cannot find a method of including the clubs logo and buttons with hyperlinks embedded. I currently open an email with the recipient's email address, subject and a greeting. Then copy and paste word template in the body of the e-mail a painfully slow operation when sending to 150 individuals. I have searched the web only to find that it "cannot be done in anything but plain text" unless I want to spend hundreds of $s on a specially designed programme. Please Help Steve, I'm sure you know how to achieve this.

  • @yelirnoed
    @yelirnoed 6 років тому

    Hi Steve, and thank you for this excellent video. I'm using your timer video and am able to auto send out an email using the timer logic which works beautifully combining this email logic with the timer logic...:) If I may trouble you however: How would I automatically open and attach a single report within my access reports as an attachment as opposed to browsing to a folder and attaching a document? Can this be done? I look forward to hearing from you. My Best, YelirNoed.

  • @slewcity140
    @slewcity140 6 років тому

    this was excellent thank you. I generate about 300 statements from an access application I created. I have code that filters statements to be sent by postal mail and statement to be emailed only. Now the email only list is getting large. when I run the report their are many email only statement. I would like to create a routine that would convert the many statements for each customer generated in one report to a pdf then email each one to the associated email address for that customer and run as a batch. Any ideas?

  • @active769
    @active769 4 роки тому

    Question, I am running Access 2016, I used the send email code, but I get the "Compile Error: User-defined typed not defined" in reference to Dim oApp As New Outlook.Application... Can you help me with this? thanks

  • @kennynelson398
    @kennynelson398 6 років тому

    Can you attach a FILTERED report to an email using this method?

  • @anhongoc6277
    @anhongoc6277 7 років тому

    Hi Sir, I'm trying to send a an email to customer. The email is exactly the report which have an attachment in it. I want to use the report content for the email body, and automatically attach the attachment in the report into to email attachment and then send. I really appreciate any help!

  • @KeffelewAssefa
    @KeffelewAssefa 2 роки тому

    Thank you.

  • @miggy71
    @miggy71 7 років тому

    Hi Steve, Instead of a path to a file attachment, is there a way to attach an Access Query in Excel format? I tried using DoCmd.SendObject and set the EditMessage Parameter to 'False' but it still opens the email and requires me to hit 'Send'. I just want it to send immediately. Must I save the excel/query file and use that path as you've done in this demo? Thanks in advance. Follow up, I did a DoCmd.OutputTo acOutputQuery for my query (which seems to work fine) and now I'm getting Error 287 (application-defined or object defined error). Code stops at the ".Send" line. I noticed if I mouse over the "oEmail.To" or "oEmail.Body" it shows the error text, but the "oEmail.Subject" shows the subject I entered.

  • @active769
    @active769 4 роки тому

    Thanks for the video. I want to ask. Is there a way that you can send an invite to someone to add on both of your outlook calendars?

  • @Holmes213
    @Holmes213 6 років тому

    So, I put this in my database and i am getting question marks in front of the file path. e.g. "??C:\Documents\Attachment.pdf". I then get an error "Run-time error '-2147024773 (8007007b)': File name or directory name is not valid." Why is it placing question marks in my file?

  • @ristantosky
    @ristantosky 5 років тому

    how to use email protocol without depend on user outlook ? I meant can we use outlook from server or there are ways to do that ?

  • @rajeshwargarlapalli790
    @rajeshwargarlapalli790 7 років тому

    Hi All,
    I need your help to create a macro,
    I have an excel file in Outlook mail box, which need to be copied to MS Access. How can I get that?

  • @rickl2834
    @rickl2834 6 років тому

    Is there a way to do multiple attachments on an email? I’d like to send a pic and spreadsheet on one email as opposed to two separate ones. Thank you.

  • @kadnacer7571
    @kadnacer7571 5 років тому

    Hi Steve, how can we add signature to email based on default one created in outlook

  • @abiramimannarmannan2314
    @abiramimannarmannan2314 5 років тому

    can u pls share video to automatic generating mail to birthday people using ms access

  • @WafferG
    @WafferG 7 років тому

    I have a question , lets say I have the emails in tblWorkers , And I made a select query to select all the emails . Is there any way I can send an email to all these people ina press of a button , I dont want the user to write the emails in the To: box or to mess with any email addresses or anything so to speak , just one button that will send an email to all the email adresses selected in a query , is something like this possible, There is a paid add on for access but it costs 500$ , Inlighten me.

  • @dniezby
    @dniezby 7 років тому

    What if I have several email accounts in my outlook and I want to send from a specific account? How would I pull that off?

  • @rickguest1580
    @rickguest1580 8 років тому

    Hi Steve, I'm really enjoying all your MS Access courses. There's a lot of great information in them, and I find how you present it helps me understand it. Thanks !
    Since you presented how to use Outlook mail from Access / VBA in this video it made me wonder if the rest of Outlook can be accessed (no pun intended) from Access / VBA.
    Can I get or put entries in my Contacts ? Or read or update my Calendar ?

    • @ProgrammingMadeEZ
      @ProgrammingMadeEZ  8 років тому +1

      Yup. You can access contact, Calendar, tasks, etc.

  • @jooryalhamed938
    @jooryalhamed938 4 роки тому

    Hello, thank you so much for your wonderful and useful videos. I followed your code but that gave me a run time error "invalid use of null" why do you think I got this error and you didn't?

  • @kazuo_ohashi
    @kazuo_ohashi 9 років тому

    Thank you Steve ! Great tips on how to integrate Outlook with Access. Can I make a suggestion , Is it possible to create, and most important, update a Outlook contact from a Access table ?

    • @ProgrammingMadeEZ
      @ProgrammingMadeEZ  9 років тому

      +Kazuo Ohashi Yes. You can use the MAPI namespace to find the contact and update it. This is VERY involved.

  • @matthewjones9070
    @matthewjones9070 8 років тому

    Would I be able to take this bit of code and throw it in to an application I'm working on in Visual Studio? I can't see why it would not work. my only question is what about authentication?

    • @ProgrammingMadeEZ
      @ProgrammingMadeEZ  8 років тому +1

      +Matthew Jones .NET and Access are not compatible.

  • @RK-fp7ob
    @RK-fp7ob 7 років тому

    SOLVED (changed registry key values)
    This is the code i use to open outlook application and send a email for that current viewed customer.
    It works fine but the only problem i have is that it opens outlook behind my access application and
    it only comes foreward when i click on outlook.
    i`ve tried different things with ".Display" / tried "OLApp.ActiveWindow.Activate", but it doesnt seem to work.
    What can i do ???
    -------------------------------------------------------------------
    Sub Sendemail()
    Dim oOutlook As Outlook.Application
    Dim oEmailitem As mailitem
    On Error Resume Next
    Err.Clear
    Set oOutlook = GetObject(, "Outlook.application")
    If Err.Number 0 Then
    Set oOutlook = New Outlook.Application
    End If
    Set oEmailitem = oOutlook.createitem(olMailitem)
    With oEmailitem
    .To = [Emailadress]
    .Display
    End With
    Set oEmailitem = Nothing
    Set oOutlook = Nothing
    --------------------------------------------------------------------
    Private Sub Knop427_Click()
    Call Sendemail
    End Sub

  • @katrinasmith5108
    @katrinasmith5108 8 років тому

    Instead of using the Browse button - and I wanted to attach a report from within the database (as a default) - how do I find the path of the report?

    • @ProgrammingMadeEZ
      @ProgrammingMadeEZ  8 років тому

      +Katrina Smith You could first save the report as a file, save the filename in a variable, and replace the attachment value with the filename variable.

  • @johnwatkins39
    @johnwatkins39 7 років тому

    great video, with the email textbox, can i paste an email address, for example 10 +, i think i could i may have to make the textbox bigger to be able to see some of the emails in the textbox.

  • @quranaurhadeesno.1491
    @quranaurhadeesno.1491 5 років тому

    sir, can we send sms from ms access?

  • @lilkimmacdaddy8542
    @lilkimmacdaddy8542 7 років тому

    Hi Steve, the codes work via Outlook 2013 and not Outlook 2016. I have set the reference to Outlook 2016 Library. Any help you could provide would greatly be appreciated. Thanks!

    • @SunehaJulka
      @SunehaJulka 4 роки тому

      I am facing the same issue. Can anyone help please

  • @toneill360
    @toneill360 7 років тому

    Hi Steve, I have created an app with access that uses this send email with outlook. I built the app in office 16 and it works without any issues. However, when opened with office 13 there is an error with the vb. The outlook reference is turned on with the 13 version. Any suggestions?

    • @toneill360
      @toneill360 7 років тому

      So, it seems that Outlook references in vb are not backward compatible... Currently, if I need to make any changes in with the vb, I have to open the app and save it in office 13 to work with both versions.

  • @youtubetube1815
    @youtubetube1815 8 років тому

    im getting a "user-defined type not defined" error on the line : Dim fileDiag As FileDialog

    • @ProgrammingMadeEZ
      @ProgrammingMadeEZ  8 років тому

      +UA-cam Tube Sounds like you're missing a reference.

  • @aboutKINGYEUNG
    @aboutKINGYEUNG 7 років тому

    If Len(Me.txtAttachment) > 0 Then
    oEmail.Attachments.Add Me.txtAttachment.Value
    End If
    i cannot debug it with .value
    is there any code need to be done before use?

    • @ProgrammingMadeEZ
      @ProgrammingMadeEZ  7 років тому +1

      Instead of len(me.txtattachment) > 0, do If Not IsNull(me.txtAttachment) then. You should also use a File System Object to check if the file exists before attaching it.

  • @luisvalenzuela8297
    @luisvalenzuela8297 8 років тому

    Hello Steve, I'm recently working with Access to program a small application for production purposes, where a person fills the blank spaces and then sends a requisition to the department. When they click on a button (Save button) this one generates an automatic mail response to the applicant and the responsible to attend the issue. My doubt is that the email body is not being sent correctly, I'm using this part of the code to send the body: (Email_Body = Me.APLICANT.Column(1, Me.APLICANT - 1) & " ha solicitado un cambio de ingeniería en: " & Me.PART_NUMBER & Chr(13) & Me.DESCRIPTION.Text) where every variable is correctly defined but when you open the mail it has no body, the code shows no mistake either...
    I wonder what do you think about this issue?

    • @ProgrammingMadeEZ
      @ProgrammingMadeEZ  8 років тому

      +Luis Valenzuela What happens if you take the variables out?

    • @luisvalenzuela8297
      @luisvalenzuela8297 8 років тому

      +Programming Do you mean the ones that are defined at the beginning of the subform for the Save button?

    • @ProgrammingMadeEZ
      @ProgrammingMadeEZ  8 років тому

      +Luis Valenzuela Anything that refers to a value which is retrieved from the form. As in, what happens when you try to send the email as just text that you write up as a string.

  • @Paw0452
    @Paw0452 7 років тому

    Hi Steve, your videos are a great help to me. I have implemented the vba for sending an email from Access 2010 but I must have Outlook open else I get the error message "Application-defined or object-defined error" when the code reaches this line of code : "oEmail.Recipients.Add v_email_in" where v_email_in is the email address. I am missing something in the code?

    • @Paw0452
      @Paw0452 7 років тому

      Steve, I get the same result using early or late binding. Thanks

    • @ProgrammingMadeEZ
      @ProgrammingMadeEZ  7 років тому

      It is too difficult to know based on your message. My best guess is you need to make sure the email address is a string.

  • @johndavy3820
    @johndavy3820 6 років тому

    Steve, I am getting errors with your code. I have screen clips to send you. Can you reply to me so I can send them? I have subscribed.

  • @islahiyette1
    @islahiyette1 6 років тому

    i want send a querey in boduy mail?? how

  • @abuaksham
    @abuaksham 8 років тому

    Thanks for the useful information.
    can I open a saved .msg file (saved e mail) and reply to it through Access ?

    • @ProgrammingMadeEZ
      @ProgrammingMadeEZ  8 років тому

      You can, but that's a bit beyond the scope of any of my courses, and there's not a lot of requests for something this specific.

  • @WVUTOAD1
    @WVUTOAD1 7 років тому

    So when I hit "Send", I get a Run-time error '287: Application-defined or object-defined error. When I select "Debug", it highlights "If Not IsNull(.To) And Not IsNull(.Subject) And Not IsNull(.Body) Then"
    It's getting frustrating because I even downloaded the code and copied it just to make sure I didn't put in an extra space and it still gives me the same error.

    • @ProgrammingMadeEZ
      @ProgrammingMadeEZ  7 років тому

      Are you sure you're inside of a With block?

    • @WVUTOAD1
      @WVUTOAD1 7 років тому

      Private Sub btnSend_Click()
      Dim oApp As New Outlook.Application
      Dim oEmail As Outlook.MailItem
      Set oEmail = oApp.CreateItem(olMailItem)
      oEmail.To = Me.txtTo
      oEmail.Subject = Me.txtSubject
      oEmail.Body = Me.txtBody
      If Len(Me.txtAttachment) > 0 Then
      oEmail.Attachments.Add Me.txtAttachment.Value
      End If
      With oEmail
      If Not IsNull(.To) And Not IsNull(.Subject) And Not IsNull(.Body) Then
      .Send
      MsgBox "Email Sent!"
      Else
      MsgBox "Please fill out the required fields."
      End If
      End With
      oEmail.Send
      End Sub

    • @cindyhe5609
      @cindyhe5609 5 років тому

      @@WVUTOAD1 Have you solve this problem, I also got the same error. Please tell me if you got solved.

  • @childrenshealth
    @childrenshealth 8 років тому

    How Can I populate the .to field with data from an existing form? And can I use it to open an existing custom form template in outlook that I have created already?

    • @ProgrammingMadeEZ
      @ProgrammingMadeEZ  8 років тому +1

      +Raise Your Kids Healthy By Nathani Clinic just set the to property to the value from the textbox.

    • @drtonys.6963
      @drtonys.6963 6 років тому

      using openargs, then onopen event me.to = me.openargs

  • @MegaMohammad2011
    @MegaMohammad2011 7 років тому

    Hi Steve,
    Can you teach me how to create automatic email sender in access? I want it to send email through outlook automatically

    • @ProgrammingMadeEZ
      @ProgrammingMadeEZ  7 років тому

      Isn't that what this video teaches you?

    • @MegaMohammad2011
      @MegaMohammad2011 7 років тому

      Not really. I want it to open outlook by itself and send a general email to like multiple people. Like an automated reminder email for overdue tasks or such.

    • @MegaMohammad2011
      @MegaMohammad2011 7 років тому

      Programming I would appreciate it though

    • @ProgrammingMadeEZ
      @ProgrammingMadeEZ  7 років тому +1

      So add multiple emails in the oEmail.To. As for automated tasks, watch my video on how to use a timer. ua-cam.com/video/dIJXFmxCMts/v-deo.html

    • @MegaMohammad2011
      @MegaMohammad2011 7 років тому

      Awesome video. I figured out everything. But I have one more issue. After the email is being written, I run command ".Display" so I can review the email and see if it is being run properly, but my signature happens to get lost. I have a signature on my outlook that would pop up with a new message. Is there a way I could run a command that would bring my signature back again with out me trying to rewrite it as a string?

  • @sajjadahmad6436
    @sajjadahmad6436 5 років тому

    Sir how to send Sms to Students Parents By Mbile ???

  • @migueljrenriquez4573
    @migueljrenriquez4573 8 років тому

    Hi sir, what if i want to assign some of field on the body of the email, then how can i do it? Thanks

    • @ProgrammingMadeEZ
      @ProgrammingMadeEZ  8 років тому

      +Migueljr Enriquez I'm not really sure what you're asking.

  • @funkyfont
    @funkyfont 8 років тому

    Hi, what if the end users have different versions of Office. Let's say 2010, 2013 and 2016. Thanks

  • @smarmanos
    @smarmanos 9 років тому

    Doesn't work with Access 2007 for some reason.

    • @ProgrammingMadeEZ
      @ProgrammingMadeEZ  9 років тому

      +Manos Smar What kind of error are you getting? At what point doesn't it work?

    • @smarmanos
      @smarmanos 9 років тому

      +Programming I get an "Application-defined or object-defined error.
      Where can I send you a screen shot?

    • @ProgrammingMadeEZ
      @ProgrammingMadeEZ  9 років тому

      +Manos Smar I suggest doing a screen shot and posting it to imgur, then post the link here.

    • @smarmanos
      @smarmanos 9 років тому

      +Programming imgur.com/LgpL4Wm

    • @ProgrammingMadeEZ
      @ProgrammingMadeEZ  9 років тому

      Ok, change the IsNull(.To) to IsNull(me.txtTo) assuming your textbox with the emails to send it to is called me.txtTo.

  • @asharshehzad
    @asharshehzad 7 років тому

    very good thank you very much but please if posible then also paste codes for us

    • @ProgrammingMadeEZ
      @ProgrammingMadeEZ  7 років тому

      The code is in the work files. There's a link in the description.

    • @asharshehzad
      @asharshehzad 7 років тому

      +Programming thank you welldone plz also guide about php and html plz

  • @simplestsofthazlosencillo3078
    @simplestsofthazlosencillo3078 3 роки тому

    I mean, how can I send an access report attachment with this code ?