Reply
 
Thread Tools Display Modes
  #1   Report Post  
Posted to microsoft.public.word.docmanagement
Erick Erick is offline
external usenet poster
 
Posts: 10
Default 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   Report Post  
Posted to microsoft.public.word.docmanagement
Lene Fredborg Lene Fredborg is offline
external usenet poster
 
Posts: 1,291
Default 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   Report Post  
Posted to microsoft.public.word.docmanagement
Erick Erick is offline
external usenet poster
 
Posts: 10
Default 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   Report Post  
Posted to microsoft.public.word.docmanagement
Lene Fredborg Lene Fredborg is offline
external usenet poster
 
Posts: 1,291
Default 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

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Header with picture or text box Scott Page Layout 15 April 28th 23 02:52 AM
Creating dynamic cross reference links in a Word document torajudo Microsoft Word Help 5 April 27th 23 08:57 PM
autoshape text wrapping cayce Page Layout 6 June 16th 06 09:42 PM
Word applies direct format on File open Uriel Microsoft Word Help 16 November 27th 05 07:22 PM
Outline Renee Hendershott Page Layout 2 December 25th 04 02:49 PM


All times are GMT +1. The time now is 11:53 AM.

Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 Microsoft Office Word Forum - WordBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Word"