Create a simple HTML editor in a Userform

TassadarExcel

New Member
Joined
Nov 22, 2017
Messages
12
Hi all,

I have an excel sheet that performs some automatic tasks, one of them is creating a string that contains a HTML formatted text that contains the body of an email and then sending it via email.

I'd like to have the possibility of showing the formatted result of the email body generated before sending it, this is possible using "Microsoft Webbrowswer". But my problem is I want to go further, I want not only be able to show the formatted HTML, but also edit it and make changes when needed.

I need the procedure to be:

1.- Program creates the string with the body of the email into a string variable.

2.- Program opens a form and show the content formatted in HTML in some kind of textbox (like "Microsoft Webbrowswer" does) but having the possibility to edit this text and have some simple controls to set bold, underline, font size, text color and highlight text. No need to create tables, links, insert images, icons....

I mean, something like what I have just now writing this post, but even more simple:

f1b62o.png


3.- When user press Accept button on the form, the modified email body once edited by the user overwrites the original HTML content in the string variable, so when the email is sent program send with the changes user has made.

Anyone can help me with this?

Many thanks and regards in advance
 
Last edited:

Excel Facts

How to find 2nd largest value in a column?
MAX finds the largest value. =LARGE(A:A,2) will find the second largest. =SMALL(A:A,3) will find the third smallest
Sorry, now I see I were not crear in what I need and now I can't edit my main post.

The program is already made, works and send the emails, I only need a form element (like standard TextBox or "Microsoft Webbrowser") that allows me to show and edit formatted HTML.

Regards
 
Upvote 0
.
If you are using VBA to create and send the email .... you can avoid creating the form you described.

In the code change .Send to .Display

This will show the email prior to sending, and allows you to edit the email body.
 
Upvote 0
.
If you are using VBA to create and send the email .... you can avoid creating the form you described.

In the code change .Send to .Display

This will show the email prior to sending, and allows you to edit the email body.

Hi Logit,

Sorry me, I've not been able to try your solution until now. Unfortunately changing .Send to .Display changes nothing at all. I thought I could open a Outlook window with the message ready to press "Send" button, giving me the possibility of making changes before sending.

Unfortunately the message is sent exactly in the same way when I used .Send.

I'm afraid I need to find a way to show the formatted HTML text in a form as I had as first idea.

Anyone can help?

Many thanks and regards
 
Upvote 0
.
If you are using VBA to create and send the email .... you can avoid creating the form you described.

In the code change .Send to .Display

This will show the email prior to sending, and allows you to edit the email body.

Hi again, please ignore prior message, by mistake I changed .Send to .Display in the wrong function.

I'm very happy, it's not the solution I had in my mind and I really would prefer editing the HTML as I described sice it means remove one step from the process (for other reason I have to keep a form), but it works perfectly and it's a completely valid solution to my problem.

Many thanks and regards
 
Upvote 0

Forum statistics

Threads
1,214,825
Messages
6,121,788
Members
449,049
Latest member
greyangel23

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