+ Reply to Thread
Results 1 to 10 of 10

Automatic Email Macro on run

  1. #1
    Forum Contributor
    Join Date
    01-28-2014
    Location
    Manchester, UK
    MS-Off Ver
    Microsoft Office 365
    Posts
    127

    Automatic Email Macro on run

    Evening all

    I am currently playing around with the below code and wondered if someone can assist.

    I am trying to send an email to the email address contained in cell H4 but when i run the below nothing happens.

    The only change i have made is to the value on the "To" section.

    Any ideas?

    Please Login or Register  to view this content.

  2. #2
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Automatic Email Macro on run

    Well, have you gone through the code step-by-step?
    If it stopped working only because you change the To value then I would certainly go through the code step by step
    'Not working' is non-information.
    We need more to go on
    ---
    Hans
    "IT" Always crosses your path!
    May the (vba) code be with you... if it isn't; start debugging!
    If you like my answer, Click the * below to say thank-you

  3. #3
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Automatic Email Macro on run

    I would deactivate the On Error line so you actually get the error.

  4. #4
    Forum Contributor
    Join Date
    01-28-2014
    Location
    Manchester, UK
    MS-Off Ver
    Microsoft Office 365
    Posts
    127

    Re: Automatic Email Macro on run

    Hi Keebellah

    The error i get is as per the below.

    Microsoft Visual Basic for Applications
    System Error &H80004005 (-2147467259).

    Cheers
    Dave

  5. #5
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Automatic Email Macro on run

    That doesn't tell me anything. Which line is it generated on? At what moment?

  6. #6
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Automatic Email Macro on run

    What are the references set under tools in your VBA project?

  7. #7
    Forum Contributor
    Join Date
    01-28-2014
    Location
    Manchester, UK
    MS-Off Ver
    Microsoft Office 365
    Posts
    127

    Re: Automatic Email Macro on run

    Hi Keebellah

    The error is generated on the below line.

    .To = ThisWorkbook.Sheets("Input Sheet").Cells(8, 4).Value

    If i replaced the above line with my email address in speech marks then the macro works fine.

    Cheers
    Dave

  8. #8
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Automatic Email Macro on run

    What is the exact content of the cell value?
    Should work so my guess the value in that cell is incorrect (not an email address) or did you place more than one email address?

    You could try
    Please Login or Register  to view this content.

  9. #9
    Forum Contributor
    Join Date
    01-28-2014
    Location
    Manchester, UK
    MS-Off Ver
    Microsoft Office 365
    Posts
    127

    Re: Automatic Email Macro on run

    Hi Keebellah

    The actual cell content is a formula which is pulling in the email address dependant on the value of another cell.

    I tried the above and that also didnt work.

    Thanks

  10. #10
    Forum Expert Keebellah's Avatar
    Join Date
    01-12-2014
    Location
    The Netherlands
    MS-Off Ver
    Office 2021 (Windows)
    Posts
    7,905

    Re: Automatic Email Macro on run

    Without actually seeing the content it's impossible to say.
    If you say that when you enter an email address it works but not with the cell value then you'll have to check that

    The error is clearly in your input not the macro, maybe passing it to a variable first?

    Please Login or Register  to view this content.
    You will have to step through the code and see what really happens

+ 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. Need Macro for sending an automatic email based on expiry dates
    By abeharrell in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 09-11-2017, 12:12 PM
  2. Replies: 0
    Last Post: 05-31-2016, 01:23 PM
  3. [SOLVED] Automatic update pivottable in closed workbook and email macro
    By wrybel in forum Excel Programming / VBA / Macros
    Replies: 0
    Last Post: 06-16-2015, 09:16 AM
  4. Automatic Email Alert from Excel Macro
    By tomskelly89 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 11-17-2014, 02:58 PM
  5. Macro to create workbooks with key field name and automatic email
    By su_nil in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-11-2010, 09:16 AM
  6. Automatic Email Macro
    By Jrockusa in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-22-2010, 12:55 PM
  7. Automatic email of excel contents as email body
    By naveenn08 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-09-2009, 08:26 AM

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