PDA

View Full Version : Solved: font Character



Pasquale
09-03-2005, 10:36 PM
Hallo,
I have doc in a font inserted in an exe file (IGreco_00).
I have the character map.
It is possible to make a macro for converting font from a character map to another?

thanks pasquale:dunno :dunno

Pasquale
09-05-2005, 09:22 AM
Hallo,
I actualise a long Macro to convert "one by one" a set of characters with two character-set.
1) First font is Igreco_00 (inserted in a exe file) (i extracted the map with X-fonter);
2) the second is Times New Roman;
3) the third is Bwgrkl.

Now i need to replace or format all Bwgrkl characters in bold, I don't know how to make.
A piece of the macro:
With Selection.Find
'chr 195/90BW
.Text = "?"
.Replacement.Text = "Z"
.Font.Name = "IGreco_00"
.Replacement.Font.Name = "Bwgrkl"
End With
Selection.Find.Execute Replace:=wdReplaceAll

I need that all Replacement text in Bwgrkl font name is bold.

Thanks

pasquale:( :( :bug:

TonyJollans
09-05-2005, 10:03 AM
Hi Pasquale,

I'm not sure I understand what your problem is here.

Is your macro working as far as it goes?

If you just want to include Bold formatting in some of the replacements, add the line:

Selection.Find.Replacement.Font.Bold = True

wherever you want it.

But, you could make your whole macro easier to read by not constantly resetting things which aren't changing. You should be able to do ..

With Selection.Find
.ClearFormatting
.Replacement.ClearFormatting
.Font.Name = "IGreco_00"
.Replacement.Font.Name = "Times New Roman"
End With

Selection.Find.Execute FindText:="^p", ReplaceWith="^p", Replace:=wdReplaceAll 'chr paragrafo
Selection.Find.Execute FindText:=" ", ReplaceWith=" ", Replace:=wdReplaceAll 'chr spazio
' etc.
Selection.Find.Execute FindText:="?", ReplaceWith="?", Replace:=wdReplaceAll 'chr 254

With Selection.Find
.Replacement.Font.Name = "Bwgrkl"
.Replacement.Font.Bold = True
End With

Selection.Find.Execute FindText:="?", ReplaceWith="|", Replace:=wdReplaceAll 'chr 130/124BW
Selection.Find.Execute FindText:="?", ReplaceWith=".", Replace:=wdReplaceAll 'chr 131/046BW
' etc.

I would also, personally, use the Chr function instead of the odd characters ..

Selection.Find.Execute FindText:=Chr(130), ReplaceWith=chr(124), Replace:=wdReplaceAll 'chr 130/124BW
Selection.Find.Execute FindText:=Chr(131), ReplaceWith=Chr(46), Replace:=wdReplaceAll 'chr 131/046BW
' etc.

I hope I've typed that in correctly - none of it is tested :)

Pasquale
09-05-2005, 10:49 AM
Hi Tony,
It works,
But i would to make your personal macro (use the Chr function instead of the odd characters).Is this the macro?
With Selection.Find
.ClearFormatting
.Replacement.ClearFormatting
.Font.Name = "IGreco_00"
.Replacement.Font.Name = "Times New Roman"
.Replacement.Font.Size = 12
End With

Selection.Find.Execute FindText:=Chr(130), ReplaceWith=Chr(130), Replace:=wdReplaceAll 'chr 130/130TNR
Selection.Find.Execute FindText:=Chr(131), ReplaceWith=Chr(131), Replace:=wdReplaceAll 'chr 131/131TNR ' etc.

With Selection.Find
.Replacement.Font.Name = "Bwgrkl"
.Replacement.Font.Bold = True
.Replacement.Font.Size = 14
End With




Selection.Find.Execute FindText:=Chr(230), ReplaceWith=chr(124), Replace:=wdReplaceAll 'chr 230/124BW

Selection.Find.Execute FindText:=Chr(231), ReplaceWith=Chr(46), Replace:=wdReplaceAll 'chr 231/046BW
' etc.


This other lines are important?
direction:=0, MatchCase:=1, WholeWord:=0, PatternMatch:=0, ReplaceAll:=1, Format:=0, Wrap:=0

Thanks Pasquale

TonyJollans
09-05-2005, 11:40 AM
Looks good to me :)

Pasquale
09-05-2005, 10:20 PM
Hi Tony,

Bold is correct and the macro works.
Doesn't work this macro:


With Selection.Find
.ClearFormatting
.Replacement.ClearFormatting
.Font.Name = "IGreco_00"
.Replacement.Font.Name = "Times New Roman"
.Replacement.Font.Size = 12
End With



Selection.Find.Execute FindText:=Chr(130), ReplaceWith=Chr(130), Replace:=wdReplaceAll 'chr 130/130TNR


Selection.Find.Execute FindText:=Chr(131), ReplaceWith=Chr(131), Replace:=wdReplaceAll 'chr 131/131TNR ' etc.

With Selection.Find
.Replacement.Font.Name = "Bwgrkl"
.Replacement.Font.Bold = True
.Replacement.Font.Size = 14
End With






Selection.Find.Execute FindText:=Chr(230), ReplaceWith=chr(124), Replace:=wdReplaceAll 'chr 230/124BW


Selection.Find.Execute FindText:=Chr(231), ReplaceWith=Chr(46), Replace:=wdReplaceAll 'chr 231/046BW
' etc.








I send a sample

thanks pasquale

TonyJollans
09-06-2005, 01:09 AM
What doesn't work? Does it do anything? Does it replace some characters and not others? Or do some wrongly? Or not set the Font? Or what?

Pasquale
09-06-2005, 02:11 AM
Hi Tony,
The macro open immediately VBA-DEBUG and all lines

Selection.Find.Execute FindText:=Chr(230), ReplaceWith=chr(124), Replace:=wdReplaceAll 'chr 230/124BW
become in red color

however I solved my problem with first long macro,
it could better and easier the macro with CHR codex.

Pasquale

TonyJollans
09-06-2005, 03:10 AM
Change ReplaceWith=Chr(124)
To ReplaceWith:=Chr(124)

TonyJollans
09-06-2005, 03:11 AM
Sorry, my typo!

I did say I hadn't tested it!

Pasquale
09-06-2005, 04:50 AM
Hi tony it works,
a little problem the macro format all letters in capital letters, i need to let the format such it is (no changes at the format of letters).

Pasquale

TonyJollans
09-06-2005, 11:21 AM
Hi Pasquale,

Try adding ...

Selection.Find.MatchCase = True

at the beginning.

Pasquale
09-06-2005, 03:15 PM
Hi Tony,
Ok excellent.
Pasquale