Suppose you paste this line to Word 2003:
<b>ABC</b>
Is it possible that word will make ABC bold and delete the two tags?
AYK, many forum editors do exactly that.
Appreciate any help.
Printable View
Suppose you paste this line to Word 2003:
<b>ABC</b>
Is it possible that word will make ABC bold and delete the two tags?
AYK, many forum editors do exactly that.
Appreciate any help.
Well this has nothing to do with VB or programming and the obvious question is did you try it?
Pretty sure Word 2003 has SAVE AS HTML (probably two choices. try each). It will convert BOLD into html tags
A. I thought a VBA macro might be needed
B. Of course, I am asking because I couldn't solve it myself.
Thanks.
Saving is no problem. The reverse, ie reading text with HTML, is.
Thanks.
Word 2003 can read HTML, so I can imagine an approach of saving (or writing by means of VBA) your HTML snippet to a temporary plain text file, then again open it with Word as HTML and copy-paste the now formatted text to the desired destination. However, that does not work with your sample HTML snippet from post #1 as-is. You'd probably need to wrap it into a proper HTML skeleton to turn it into a valid HTML file.
Another approach I can think of is simply just supporting a small subset of HTML, interpret the tags yourself and apply the formatting in your VBA code. Shouldn't be too complicated either, but of course the effort largely depends on how extensive you want your HTML support to be.
I am using Word 2002 under the file menu is Save As which has the following options web page *.htm|*.html, web page filtered, web archive, rich text and so on
There is also a save as web page on the file menu just below the save as.
Saving has already been explained by DataMiser. However, taking the approach I suggested, you wouldn't save as HTML anyway, instead you would save as plain text (i.e. unformatted). Opening an HTML file using Word's GUI works more or less the same as saving; just pick "Web Pages" as the file type to open.
Programmatically opening an HTML file would be done using a VBA command like this one:
For a properly formed HTML file, automatic format detection (Format:=wdOpenFormatAuto) would probably work as well.Code:Documents.Open FileName:="Test.htm", ConfirmConversions:=False, AddToRecentFiles:=False, Format:=wdOpenFormatWebPages