+ Reply to Thread
Results 1 to 8 of 8

command button VBA to send automated email not workbook or worksheet

  1. #1
    Registered User
    Join Date
    07-01-2010
    Location
    adelaide
    MS-Off Ver
    Excel 2003
    Posts
    86

    command button VBA to send automated email not workbook or worksheet

    Has anyone got or seen a code that can send a automated email via outlook.

    i do not want to send the workbook or worksheet but just to be able to send a text only email when command button is pushed?

  2. #2
    Registered User
    Join Date
    07-01-2010
    Location
    adelaide
    MS-Off Ver
    Excel 2003
    Posts
    86

    Re: command button VBA to send automated email not workbook or worksheet

    the recipient would always be the same eg.
    "[email protected]"

    Subject would always be the same eg.
    "SAP information required"

    and the body of text would always be the same
    "Please provide the following information:

    Sold To:
    Ship To:
    Bill To:
    Required Delivery Date:
    Comments:
    "

  3. #3
    Valued Forum Contributor smuzoen's Avatar
    Join Date
    10-28-2011
    Location
    Brisbane, Australia
    MS-Off Ver
    Excel 2003/2007/2010
    Posts
    610

    Re: command button VBA to send automated email not workbook or worksheet

    Just search the forum for "Excel Outlook". There are so many threads posted here you will get the answer. As general answer
    Please Login or Register  to view this content.
    That is the main "guts" of the email from excel code.
    Hope this helps.
    Anthony
    Pack my box with five dozen liquor jugs
    PS: Remember to mark your questions as Solved once you are satisfied. Please rate the answer(s) by selecting the Star in the lower left next to the Triangle. It is appreciated?

  4. #4
    Valued Forum Contributor smuzoen's Avatar
    Join Date
    10-28-2011
    Location
    Brisbane, Australia
    MS-Off Ver
    Excel 2003/2007/2010
    Posts
    610

    Re: command button VBA to send automated email not workbook or worksheet

    Add a button to a worksheet - assign a macro to the button - in this case macro called sndEmail
    Please Login or Register  to view this content.

  5. #5
    Registered User
    Join Date
    07-01-2010
    Location
    adelaide
    MS-Off Ver
    Excel 2003
    Posts
    86

    Re: command button VBA to send automated email not workbook or worksheet

    wonthat is wonderful thank you


    what if i wanted to change information eg.

    "Please provide the following information for equipment number: (cell reference eg. =k10)

  6. #6
    Valued Forum Contributor smuzoen's Avatar
    Join Date
    10-28-2011
    Location
    Brisbane, Australia
    MS-Off Ver
    Excel 2003/2007/2010
    Posts
    610

    Re: command button VBA to send automated email not workbook or worksheet

    The body of the email is made up of the following string
    Please Login or Register  to view this content.
    vbCrLf adds a carriage return/line feed so that will start a new line. If K10 contains a reference to the Equipment Number then
    Please Login or Register  to view this content.

  7. #7
    Registered User
    Join Date
    07-01-2010
    Location
    adelaide
    MS-Off Ver
    Excel 2003
    Posts
    86

    Re: command button VBA to send automated email not workbook or worksheet

    i cant seem to get this to work

    how about changing the first line of the body of text

    "Please provide the following information for equipment :" then insert number from k10

    and also the subject line to

    .Subject = "SAP information required" then insert number from k10

  8. #8
    Valued Forum Contributor smuzoen's Avatar
    Join Date
    10-28-2011
    Location
    Brisbane, Australia
    MS-Off Ver
    Excel 2003/2007/2010
    Posts
    610

    Re: command button VBA to send automated email not workbook or worksheet

    i cant seem to get this to work
    What do you mean? Is their no value for K10? If the value for K10 is on e.g. sheet1 then try
    Please Login or Register  to view this content.
    The same for the subject
    Please Login or Register  to view this content.
    Make sure you reference the sheet containing the value for K10 (substitute Sheet1 for whatever the sheet is called)
    Try this - if that does not work then simply upload a sample workbook with no sensitive data and I will fix the code - to place the value in K10 into the email is not difficult to do - it is probably referencing issue - without a sample workbook it is difficult to tell. Just upload the workbook with the sheets containing the button and the sheet with the value for K10 - if the button and the value for K10 are on different sheets then referencing will be your problem. This should be easy to fix rather than manually entering the value from K10!

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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