+ Reply to Thread
Results 1 to 7 of 7

Creating an Outlook Email from Excel

  1. #1
    Valued Forum Contributor
    Join Date
    07-10-2017
    Location
    Toronto, Ontario
    MS-Off Ver
    Excel 2013
    Posts
    430

    Creating an Outlook Email from Excel

    I found a template for a code online to auto-generate an Outlook e-mail from a spreadsheet. The code is working perfectly (displays exactly what I want in the e-mail), but if I hit "send" or change .display to .send, it gives me an error (and I can't find out what error it is, as my msgbox returns "0:"). Any ideas on what is causing this?
    Please Login or Register  to view this content.

  2. #2
    Forum Expert
    Join Date
    02-14-2009
    Location
    .
    MS-Off Ver
    ................
    Posts
    2,840

    Re: Creating an Outlook Email from Excel

    Have you checked if the Error number is set to anything other than 0 (0 means 'No errors')

    On second thought - remove the 'On Error Resume Next' ... and then see what happens. I don't understand th elogic of
    Please Login or Register  to view this content.
    Last edited by cytop; 07-12-2017 at 12:33 PM.

  3. #3
    Valued Forum Contributor
    Join Date
    07-10-2017
    Location
    Toronto, Ontario
    MS-Off Ver
    Excel 2013
    Posts
    430

    Re: Creating an Outlook Email from Excel

    I just tried adding err.number = 1 and the start of my sub, and at the end the msgbox still displays "0:"

    That didn't seem to have an effect.

    My thought process was that it would display the error number of whatever the issue was (it was previously On Error GoTo 0)
    Last edited by danielexcelvba; 07-12-2017 at 12:35 PM.

  4. #4
    Forum Expert
    Join Date
    02-14-2009
    Location
    .
    MS-Off Ver
    ................
    Posts
    2,840

    Re: Creating an Outlook Email from Excel

    You can't assign a value to the Error Object like that, and why would you? The Error is set by VBA when an error occurs, you can query it but you cannot'set' it by assigning a value.

    The whole logic of the lines I quoted is a bit warped. You should remove all 'On Error...' statements and the line starting with the label 'Here'. Run the code and see what happens. If it errors then fine, that can be handled but you need to know if it errors or not, first.

  5. #5
    Valued Forum Contributor
    Join Date
    07-10-2017
    Location
    Toronto, Ontario
    MS-Off Ver
    Excel 2013
    Posts
    430

    Re: Creating an Outlook Email from Excel

    I was just attempting to see if the code resulted in the generation of an Error number.

    I did what you said, and there no longer seems to be an error, but pressing "send" still is not having any effect.

  6. #6
    Forum Expert
    Join Date
    02-14-2009
    Location
    .
    MS-Off Ver
    ................
    Posts
    2,840

    Re: Creating an Outlook Email from Excel

    OK. Sorry but I can't help with that at the moment - don't have a copy of Excel to hand. I only replied because the 'On Error Goto Here' followed immediately by the label 'Here' didn't really make any sense. There was no opportunity for an error to occur between those 2 lines...

    Perhaps a basic intro to error handling might be useful for you?

  7. #7
    Valued Forum Contributor
    Join Date
    07-10-2017
    Location
    Toronto, Ontario
    MS-Off Ver
    Excel 2013
    Posts
    430

    Re: Creating an Outlook Email from Excel

    Alright thank you! I'll have a look at that.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. vba pull data from outlook body of email through email or subject of mail into excel
    By breadwinner in forum Excel Programming / VBA / Macros
    Replies: 4
    Last Post: 03-01-2014, 04:37 AM
  2. [SOLVED] VBA Excel creating Outlook Email
    By Optiprime in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 08-08-2013, 10:39 AM
  3. Creating a button which will create pdf out of my activesheet and email using outlook
    By Aaron De Sin in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-06-2013, 09:17 PM
  4. export outlook 2007 email into excel with subject and body of email
    By akulka58 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 02-25-2013, 02:37 PM
  5. How to parse data in Outlook email using HTML version of email back to excel
    By bnasty in forum Excel Programming / VBA / Macros
    Replies: 21
    Last Post: 10-31-2012, 02:54 PM
  6. Replies: 2
    Last Post: 08-01-2012, 02:47 PM
  7. Email using Excel VBA and Keeping Outlook Signature on the Email
    By Shama in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 02-13-2009, 07:39 PM
  8. macro creating email using outlook express
    By Khaos176 in forum Excel Programming / VBA / Macros
    Replies: 10
    Last Post: 11-04-2008, 12:04 PM

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1