Inserting codes

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I need to be able to detect bold, italic, superior and inferior characters in
word docs in order to replace with and on off code ie:

<i>some text</i>

is it possible to do this easily
 
The way you phrased this question is a bit confusing, but I think this will
answer it:

In the Find & Replace box, click on More. Then use the Format dropdown menu
in the F&R dialog to format the find or the replace box as italic,
superscript, etc, which will let you find and replace characters formatted
that way.
 
Graham said:
I need to be able to detect bold, italic, superior and inferior
characters in word docs in order to replace with and on off code ie:

<i>some text</i>

is it possible to do this easily

Yes.

In the Replace dialog, click the More button. Click in the Find What box,
click the Format button, select Font, and click Italic in the dialog. When
you click OK there, the words "Font: Italic" appear below the Find What box.

Now click in the Replace With dialog and enter

<i>^&</i>

If you want the result to be plain instead of italic, click the Format
button, select Font, and click Not Italic in the dialog.

Finally, click the Replace All button.

You can do the same kind of replacement with the other font formats. It
would be advisable to click the No Formatting button for each of the Find
What and Replace With boxes between searches so each one starts fresh.
 
Hi Jay

Guess I didn't explain the problem properly

I have a formated word doc - what I need to do is replace the formatting
with code ie:

where a word/s are bold ineed to put in <opening bold code> WORD <closing
bold code> etc

I need to be able to do this from a macro so need to know how to replace the
hidden codes for bold italic etc.

Hope this explains the proble better.

Graham
 
Hi Jay

Guess I didn't explain the problem properly

I have a formated word doc - what I need to do is replace the formatting
with code ie:

where a word/s are bold ineed to put in <opening bold code> WORD <closing
bold code> etc

I need to be able to do this from a macro so need to know how to replace the
hidden codes for bold italic etc.

Hope this explains the proble better.

Graham
 
Hi Daiya

Guess I didn't explain the problem properly

I have a formated word doc - what I need to do is replace the formatting
with code ie:

where a word/s are bold ineed to put in <opening bold code> WORD <closing
bold code> etc

I need to be able to do this from a macro so need to know how to replace the
hidden codes for bold italic etc.

Hope this explains the proble better.

Graham
 
Hi Graham,

You did explain properly, with the small exception that you want to use a
macro. The procedure I gave you will do exactly what you asked, but
manually. Have you tried it?

Possibly the easiest way to get a macro is to record the manual steps as
described at http://word.mvps.org/FAQs/MacrosVBA/UsingRecorder.htm. Because
the recorder has a bug, though, you'll then have to modify the recorded
macro as explained in
http://word.mvps.org/FAQs/MacrosVBA/ModifyRecordedMacro.htm.

Once you have the italics part of the macro operating correctly, you can
copy the code (except for the Sub and End Sub statements) and paste it three
more times just before the End Sub line, then change "italic" to "bold",
"subscript", and "superscript" in the copies. Running the completed macro
will make all four replacements, one after another.

One bit of possible misunderstanding: There are NO "hidden codes" for
formatting in Word. You aren't replacing codes, you're working with
properties of the text.
 
Note also that you can get Format: Italic by pressing Ctrl+I and Format: Not
Italic by pressing it twice.

--
Suzanne S. Barnhill
Microsoft MVP (Word)
Words into Type
Fairhope, Alabama USA

Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.
 
Thanks again Jay

Silly me _ I looked at your reply in Netscape and couldn't make it out it
all became clear when viewd in ie.

Yes have tried it manually and it works fine will now try it in a macro just
as a further help could you send me the codes for the italic properties and
sub and super script as they may prove very useful

Thanks again

Graham
 
Hi Jay

Many thanks for all your help.

Macro works fine (except for sub and super but this is a problem with cut
and past from PDF's nothing to do with word) but just the bold and italic
working will save me hours of coding.

Thanks again

Graham
 
Back
Top