+ Reply to Thread
Results 1 to 14 of 14

Adding data from user form to email

  1. #1
    Registered User
    Join Date
    03-12-2017
    Location
    UK
    MS-Off Ver
    2013
    Posts
    30

    Adding data from user form to email

    Hi there,

    I am trying to get a little more information on how to get this user form to function as I require it.

    I have got to a stage now where I can make the user form send an email, the body of which I am working on getting to function. However I am unsure as to how to attach the details placed in the user form automatically into the email ready to be sent. I have attached a test work book & it's the sim refresh option that I am working on.

    Would it be possible for anyone to assist with how to get the data input automatically?
    Attached Files Attached Files

  2. #2
    Registered User
    Join Date
    03-12-2017
    Location
    UK
    MS-Off Ver
    2013
    Posts
    30

    Re: Adding data from user form to email

    Hi all,

    Just to add in the code I think I'm working with that will send the email. I am getting an error

    "Compile error
    Expected end sub"

    Please Login or Register  to view this content.
    In the email body where you can see "Tel" and "Contract" these are the data I would like input from the form.

    Form functions as expected now, just the code that's having issues

  3. #3
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,239

    Re: Adding data from user form to email

    You have two lines of end sub in code. Remove one
    Please Login or Register  to view this content.
    Good Luck
    I don't presume to know what I am doing, however, just like you, I too started somewhere...
    One-day, One-problem at a time!!!
    If you feel I have helped, please click on the star to left of post [Add Reputation]
    Also....add a comment if you like!!!!
    And remember...Mark Thread as Solved.
    Excel Forum Rocks!!!

  4. #4
    Registered User
    Join Date
    03-12-2017
    Location
    UK
    MS-Off Ver
    2013
    Posts
    30

    Re: Adding data from user form to email

    Please Login or Register  to view this content.
    Updated now, this is getting an email through as expected and is formatted correctly. However I cannot get the signature section to work.

    Nor do I know how to input the data from my form onto the email. Any help?

  5. #5
    Forum Expert sintek's Avatar
    Join Date
    12-04-2015
    Location
    Cape Town
    MS-Off Ver
    2013 | 2016 | 2019
    Posts
    13,239

    Re: Adding data from user form to email

    Are you referring to The textbox values on Userform named SIMrefresh.
    Is the signature path correct?
    Should this part
    Please Login or Register  to view this content.
    not be
    Please Login or Register  to view this content.

  6. #6
    Registered User
    Join Date
    03-12-2017
    Location
    UK
    MS-Off Ver
    2013
    Posts
    30

    Re: Adding data from user form to email

    Yeah the text boxes on the userform I need to input the details next to the corresponding part in the body

    ---

    Nope, neither work. The file is a HTM file as it's a Outlook signature.

    Checked file path and all ok

    Filepath taken from web browser when viewing the signature
    C:\Users\rcranny\AppData\Roaming\Microsoft\Signatures\RESOLVE_Signature.htm


    This is how the email is coming through currently (which is the right format and layout)

    Hi there,
    Tel:
    Contract:

    Could you please refresh this SIM and let me know the results please. If this SIM has been cancelled if you could please forward a reinstatement onto billing.
    & Signature
    Last edited by echoz; 04-04-2017 at 09:11 AM.

  7. #7
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,908

    Re: Adding data from user form to email

    Like this maybe.
    Change the red text to the correct userform object names.

    Please Login or Register  to view this content.
    Last edited by bakerman2; 04-04-2017 at 09:17 AM.
    Avoid using Select, Selection and Activate in your code. Use With ... End With instead.
    You can show your appreciation for those that have helped you by clicking the * at the bottom left of any of their posts.

  8. #8
    Registered User
    Join Date
    03-12-2017
    Location
    UK
    MS-Off Ver
    2013
    Posts
    30

    Re: Adding data from user form to email

    This worked perfect thanks!!

    Any ideas as to why the signature isn't working?

  9. #9
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,908

    Re: Adding data from user form to email

    How about this ?

    Please Login or Register  to view this content.

  10. #10
    Registered User
    Join Date
    03-12-2017
    Location
    UK
    MS-Off Ver
    2013
    Posts
    30

    Re: Adding data from user form to email

    Sadly not literally so close now to having this part of the project done aswell.

    Any other ideas on a way to work this as this code is one I've plucked from google

    Please Login or Register  to view this content.

  11. #11
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,908

    Re: Adding data from user form to email

    No need for other code as this works just fine.
    Notice the red \ in your string.

    Please Login or Register  to view this content.

  12. #12
    Registered User
    Join Date
    03-12-2017
    Location
    UK
    MS-Off Ver
    2013
    Posts
    30

    Re: Adding data from user form to email

    God damn file path, literally missing the beginning \

    Thanks a lot for the help bakerman, managed to get it all sorted and working as I want it to be now
    + rep

  13. #13
    Forum Guru bakerman2's Avatar
    Join Date
    10-03-2012
    Location
    Antwerp, Belgium
    MS-Off Ver
    MO Prof Plus 2016
    Posts
    6,908

    Re: Adding data from user form to email

    Glad we got it sorted out.
    Thanks for rep+.
    If this answers your question please mark the thread as Solved.

  14. #14
    Registered User
    Join Date
    03-12-2017
    Location
    UK
    MS-Off Ver
    2013
    Posts
    30

    Re: Adding data from user form to email

    Solved! Thanks

+ 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. User Form Data Entry Adding a TimeStamp
    By caltman242 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 03-14-2015, 09:15 AM
  2. [SOLVED] User Form not adding data
    By JO505 in forum Excel Programming / VBA / Macros
    Replies: 17
    Last Post: 02-07-2013, 01:21 PM
  3. Adding "All Borders" with a User Form (Similar to Data Form)
    By kgreave1 in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 06-26-2012, 01:57 PM
  4. User Form List Boxes and Adding and Deleting Data
    By learning_vba in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 05-04-2010, 06:23 PM
  5. email a user form?
    By scadaman29325 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 12-20-2007, 05:02 AM
  6. Adding data to sheet with user form
    By Jay in forum Excel General
    Replies: 1
    Last Post: 06-08-2005, 11:05 AM

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