+ Reply to Thread
Results 1 to 10 of 10

UserForm to Select Data from a Row to Include in an Email

  1. #1
    Registered User
    Join Date
    08-14-2018
    Location
    UK
    MS-Off Ver
    2013 (Work), 365 (Home)
    Posts
    17

    Question UserForm to Select Data from a Row to Include in an Email

    I have a table that auto populates from a server database. Every so often there will be a row of data that I must reject. I would like to have a button to press which generates an email and fills out bits of information in the body of text from the row of data in the table. There are three columns, of which I would like to copy the data from the specific row I am rejecting.

    I'm new to VBA, so any pointers are appreciated.

  2. #2
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    2007 Enterprise
    Posts
    4,869

    Re: UserForm to Select Data from a Row to Include in an Email

    .
    Everything EMAIL : http://https://www.rondebruin.nl/win...tlook/mail.htm

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

    Re: UserForm to Select Data from a Row to Include in an Email

    Here is a template you can use. This pulls data from row one of the attached workbook and inputs it into the body of the email. There's a test button on the doc if you want to give it a try.
    Please Login or Register  to view this content.
    Attached Files Attached Files

  4. #4
    Registered User
    Join Date
    08-14-2018
    Location
    UK
    MS-Off Ver
    2013 (Work), 365 (Home)
    Posts
    17

    Re: UserForm to Select Data from a Row to Include in an Email

    Thanks Daniel, but how do I apply this to different rows? I understand that the button only picks data from Row 1, but what if the row I need to select data from is always changing?

  5. #5
    Registered User
    Join Date
    08-14-2018
    Location
    UK
    MS-Off Ver
    2013 (Work), 365 (Home)
    Posts
    17

    Re: UserForm to Select Data from a Row to Include in an Email

    Thank you, I'll have a goosey through this.

  6. #6
    Forum Expert Logit's Avatar
    Join Date
    12-23-2012
    Location
    North Carolina
    MS-Off Ver
    2007 Enterprise
    Posts
    4,869

    Re: UserForm to Select Data from a Row to Include in an Email

    .
    I'll have a goosey through this.
    Now that is an expression I have not heard before. Please explain it's meaning (I'm pretty certain I understand already) and
    is there any history to the expression ? I did a search online but did not find anything.

    Thank you.

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

    Re: UserForm to Select Data from a Row to Include in an Email

    If you want to input the row number manually, you could use an inputbox like this. If you want the macro to auto-detect the row, you could make it search for a specific value, cell color etc. and then set i to be the corresponding row.
    Please Login or Register  to view this content.

  8. #8
    Registered User
    Join Date
    08-14-2018
    Location
    UK
    MS-Off Ver
    2013 (Work), 365 (Home)
    Posts
    17

    Re: UserForm to Select Data from a Row to Include in an Email

    Thank you so much for your help! Perfect.

  9. #9
    Registered User
    Join Date
    08-14-2018
    Location
    UK
    MS-Off Ver
    2013 (Work), 365 (Home)
    Posts
    17

    Re: UserForm to Select Data from a Row to Include in an Email

    Sorry for being a complete rookie, but could I also require some pointers with formatting the text on the email. The text I'd like to have displayed in the body is:

    Hello *Cells(i, 4)*

    The request you have submitted for *Cells(i, 1)* has been rejected for the following reason:

    Blah blah blah

    Kind regards,

    Tom

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

    Re: UserForm to Select Data from a Row to Include in an Email

    Try
    Please Login or Register  to view this content.
    If you want to change the spacing you can edit
    Please Login or Register  to view this content.
    To
    Please Login or Register  to view this content.
    Where applicable. Also I forgot to mention you can change .display to .send if you want to send without checking it first.

+ Reply to Thread

Thread Information

Users Browsing this Thread

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

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