Userform vba

Natsha

New Member
Joined
May 20, 2021
Messages
44
Office Version
  1. 365
  2. 2019
  3. 2016
  4. 2013
  5. 2011
  6. 2010
  7. 2007
Platform
  1. Windows
Hi all

I have to create an userform for productivity purpose... I have added form and labels and text box... Whatever I know but I dnt know how to code it..I referred videos but the code used were different and doesn't work for me... I have attached the excel sheet..

In sheet two j have mentioned the fields format.. after referring it you can delete it.

I also added an commons button for email..
After entering data In the form..I will click the email and it should send an mail in Outlook with the below format.

To: " I can add it
Cc: I can add it
From: my mail

Hi name,

Please find the productivity status for the day


" Productivity status should be below here with a table or an snap

Signature..

Please help..I been struggling to do this.

Excel sheet
Also posted here Need help on userform creating
 
Last edited by a moderator:
Since you are using HTML elements (<br>), then you should be using the HTMLBody property. The following should do the trick:

VBA Code:
strbody = "<div style=""font-size:16px"">Hi," & "<br>" & _
"Please find the productivity status for the day" & "<br/><br>" & RangetoHTML(rng) & "<br/><br>" & "Kind regards," & "<br/>" & L_01.Caption & "</div>"

Note: I prefer using <p> instead - mainly for readability - unless you need single line break:
VBA Code:
strbody = "<div style=""font-size:16px"">" & _
"<p>Hi," & "</p>" & _
"<p>Please find the productivity status for the day</p>" & _
"<p>" & RangetoHTML(rng) & "</p>" & _
"<p>Kind regards,</p>" & _
"<p>" & L_01.Caption & "</p>" & _
"</div>"
It worked perfectly thank you...
 
Upvote 0

Excel Facts

Create a chart in one keystroke
Select the data and press Alt+F1 to insert a default chart. You can change the default chart to any chart type

Forum statistics

Threads
1,213,494
Messages
6,113,974
Members
448,537
Latest member
Et_Cetera

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top