-
October 14th, 2013, 06:17 AM
#1
Is it possible for MS Word to apply pasted HTML tags?
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.
-
October 14th, 2013, 10:47 AM
#2
Re: Is it possible for MS Word to apply pasted HTML tags?
Well this has nothing to do with VB or programming and the obvious question is did you try it?
Always use [code][/code] tags when posting code.
-
October 14th, 2013, 11:15 AM
#3
Re: Is it possible for MS Word to apply pasted HTML tags?
Pretty sure Word 2003 has SAVE AS HTML (probably two choices. try each). It will convert BOLD into html tags
-
October 14th, 2013, 03:16 PM
#4
Re: Is it possible for MS Word to apply pasted 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.
-
October 14th, 2013, 03:19 PM
#5
Re: Is it possible for MS Word to apply pasted HTML tags?
Saving is no problem. The reverse, ie reading text with HTML, is.
Thanks.
-
October 18th, 2013, 08:40 AM
#6
Re: Is it possible for MS Word to apply pasted HTML tags?
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 was thrown out of college for cheating on the metaphysics exam; I looked into the soul of the boy sitting next to me.
This is a snakeskin jacket! And for me it's a symbol of my individuality, and my belief... in personal freedom.
-
October 25th, 2013, 02:56 AM
#7
Re: Is it possible for MS Word to apply pasted HTML tags?
Originally Posted by Eri523
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.
Please show me how Word can save and read HTML. I couldn't locate HTML in "Save As" list.
Thanks for attention.
-
October 25th, 2013, 04:52 PM
#8
Re: Is it possible for MS Word to apply pasted HTML tags?
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.
Always use [code][/code] tags when posting code.
-
October 26th, 2013, 09:54 AM
#9
Re: Is it possible for MS Word to apply pasted HTML tags?
Originally Posted by Bruin 1953
Please show me how Word can save and read HTML. I couldn't locate HTML in "Save As" list.
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:
Code:
Documents.Open FileName:="Test.htm", ConfirmConversions:=False, AddToRecentFiles:=False, Format:=wdOpenFormatWebPages
For a properly formed HTML file, automatic format detection (Format:=wdOpenFormatAuto) would probably work as well.
I was thrown out of college for cheating on the metaphysics exam; I looked into the soul of the boy sitting next to me.
This is a snakeskin jacket! And for me it's a symbol of my individuality, and my belief... in personal freedom.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|