Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Placing HTML tags around italic text.
Overivew
I'm having to place HTML tags around italic text in a Word document. I don't have to convert the entire document to HTML as the document is cut and pasted into a content entry system. The content entry does the conversion though some tags have to be included manually. So Far I've learned that I can find and replace italic text with e.g. bold-that's not a problem. Is there some variable I can use in the replacement field to indicate that I want the original word along with the HTML tags? I'm envisioning something like, i&word/i where Microsoft Word knows the value of the italicized word(s) is what it just found. It's simply holding the value or word and placing the tags around it. Thanks, Erick |
#2
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Placing HTML tags around italic text.
You could use a macro to insert the tags. The macro below finds all italic
text, removes the italic formatting and inserts I.../I around the text: Sub InsertHTMLTag_Italic() Dim oRange As Range With Selection .HomeKey (wdStory) .Find.ClearFormatting End With With Selection.Find .Text = "" .Font.Italic = True .Forward = True .Wrap = wdFindStop Do While .Execute Set oRange = Selection.Range With oRange 'remove the italic .Font.Italic = False 'add tags around the text .Text = "I" & .Text & "/I" End With Loop End With Set oRange = Nothing Selection.Find.ClearFormatting Selection.HomeKey (wdStory) MsgBox "Finished." End Sub -- Regards Lene Fredborg DocTools €“ Denmark www.thedoctools.com Document automation €“ add-ins, macros and templates for Microsoft Word "Erick" wrote: Overivew I'm having to place HTML tags around italic text in a Word document. I don't have to convert the entire document to HTML as the document is cut and pasted into a content entry system. The content entry does the conversion though some tags have to be included manually. So Far I've learned that I can find and replace italic text with e.g. bold-that's not a problem. Is there some variable I can use in the replacement field to indicate that I want the original word along with the HTML tags? I'm envisioning something like, i&word/i where Microsoft Word knows the value of the italicized word(s) is what it just found. It's simply holding the value or word and placing the tags around it. Thanks, Erick |
#3
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Placing HTML tags around italic text.
Too cool. Thank you - works like a charm. Do you have a book or a source you
refer to or are you simply familiar or have worked with scripting like this for some time? Thank you very much. "Erick" wrote: Overivew I'm having to place HTML tags around italic text in a Word document. I don't have to convert the entire document to HTML as the document is cut and pasted into a content entry system. The content entry does the conversion though some tags have to be included manually. So Far I've learned that I can find and replace italic text with e.g. bold-that's not a problem. Is there some variable I can use in the replacement field to indicate that I want the original word along with the HTML tags? I'm envisioning something like, i&word/i where Microsoft Word knows the value of the italicized word(s) is what it just found. It's simply holding the value or word and placing the tags around it. Thanks, Erick |
#4
Posted to microsoft.public.word.docmanagement
|
|||
|
|||
Placing HTML tags around italic text.
Thank you for the feedback.
I have been working with macros and VBA (Visual Basic for Applications) for a long time. If you want to get started, I can recommend the articles you will find below the heading €śWord Macros and Visual Basic for Applications FAQ€ť he http://www.word.mvps.org/FAQs/MacrosVBA/index.htm You could start with the article €śGetting to grips with VBA basics in 15 minutes€ť: http://www.word.mvps.org/FAQs/Macros...csIn15Mins.htm Once you get started, you will find a lot of useful information by searching the Internet. When I started, I found it helpful to record macros in order to find the relation between the specific commands and actions in Word and the VBA objects, properties, methods, etc. This method could be helpful for you too. Also note that the online help in the Visual Basic Editor is really helpful. You run a risk - once you get started writing your own macros, you may find it hard to stop€¦ Have a good time! -- Regards Lene Fredborg DocTools €“ Denmark www.thedoctools.com Document automation €“ add-ins, macros and templates for Microsoft Word "Erick" wrote: Too cool. Thank you - works like a charm. Do you have a book or a source you refer to or are you simply familiar or have worked with scripting like this for some time? Thank you very much. "Erick" wrote: Overivew I'm having to place HTML tags around italic text in a Word document. I don't have to convert the entire document to HTML as the document is cut and pasted into a content entry system. The content entry does the conversion though some tags have to be included manually. So Far I've learned that I can find and replace italic text with e.g. bold-that's not a problem. Is there some variable I can use in the replacement field to indicate that I want the original word along with the HTML tags? I'm envisioning something like, i&word/i where Microsoft Word knows the value of the italicized word(s) is what it just found. It's simply holding the value or word and placing the tags around it. Thanks, Erick |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Header with picture or text box | Page Layout | |||
Creating dynamic cross reference links in a Word document | Microsoft Word Help | |||
autoshape text wrapping | Page Layout | |||
Word applies direct format on File open | Microsoft Word Help | |||
Outline | Page Layout |