Find font by character

F

F.H. van Zelm

Hi,

I want to read (and set) the font by character because I made a mess of some
textframes. My own fault ...

I've come as far as:
ActivePresentation.Slides(1).Shapes(1).TextFrame.TextRange.Characters(1)
to read one character.

But this 'character' has no font property.
 
F

F.H. van Zelm

Hi, Chirag,

That is what I already found: that Charachter has no font property. Thanks
for confirmation.

But now a (your) solution ...

I guess that it can be done because the interface command Format-Replace
Fonts ... also finds indivudually formatted characters.
But I can't find the VBA-way and that is what I need to stay in control.

Frans van Zelm

Chirag said:
The Characters() does have a Font property that provides you access to the
Font object:
ActivePresentation.Slides(1).Shapes(1).TextFrame.TextRange.Characters(1).Font

- Chirag

Embed Video and Audio files in PowerPoint presentations
http://officeone.mvps.org/protools/protools_embed_media.html
 
E

Edward

Characters(x) object has font.name propert that you can read or ser
you can use a loop to check all the characters in a given textbox

something like

With ActivePresentation.Slides(1).Shapes(1).TextFrame.TextRange
For li = 1 To .Characters.Count
If .Characters(li).Font.Name <> "Arial" Then
.Characters(li).Font.Name = "Arial"
End If
Next
End With

--
Best regards,
Edward


F.H. van Zelm said:
Hi, Chirag,

That is what I already found: that Charachter has no font property. Thanks
for confirmation.

But now a (your) solution ...

I guess that it can be done because the interface command Format-Replace
Fonts ... also finds indivudually formatted characters.
But I can't find the VBA-way and that is what I need to stay in control.

Frans van Zelm
 
F

F.H. van Zelm

Hi Edward,

I was wrong, you are right. Thanks for correction.

But ... (sorry), it is getting complex:
- Keystrokes MT and Almanac MT are found by your code if typed after change
of font (Format-Font, choose font, [OK] and 'type').
- Keystrokes MT and Almanac MT are not found when inserted as symbol
(Insert-Symbol, choose font, charachter and [Insert]).
- other fonts are found after inserting either way, even Brush Script MT.
- and all fonts, either way, are found by Format-Replace Fonts so ... PPt
itself does the trick but without any user control.

And, as you will guess, I used Insert-Symbols-Keystrokes MT ;-(. Many times
in huge presentations (> 1000 slides).
And this font prevents using these presentations on 'other' computers.

By the way: it is PowerPoint 2003.

Frans van Zelm


Edward said:
Characters(x) object has font.name propert that you can read or ser
you can use a loop to check all the characters in a given textbox

something like

With ActivePresentation.Slides(1).Shapes(1).TextFrame.TextRange
For li = 1 To .Characters.Count
If .Characters(li).Font.Name <> "Arial" Then
.Characters(li).Font.Name = "Arial"
End If
Next
End With
 
E

Edward

Are you sure you typed the font name correctly ( with blank spaces)?

This code should give you font names for each character in a given textrange
With ActivePresentation.Slides(1).Shapes(1).TextFrame.TextRange
For li = 1 To .Characters.Count
Debug.print .Characters(li).Font.Name
Next
End With

--
Best regards,
Edward


F.H. van Zelm said:
Hi Edward,

I was wrong, you are right. Thanks for correction.

But ... (sorry), it is getting complex:
- Keystrokes MT and Almanac MT are found by your code if typed after change
of font (Format-Font, choose font, [OK] and 'type').
- Keystrokes MT and Almanac MT are not found when inserted as symbol
(Insert-Symbol, choose font, charachter and [Insert]).
- other fonts are found after inserting either way, even Brush Script MT.
- and all fonts, either way, are found by Format-Replace Fonts so ... PPt
itself does the trick but without any user control.

And, as you will guess, I used Insert-Symbols-Keystrokes MT ;-(. Many times
in huge presentations (> 1000 slides).
And this font prevents using these presentations on 'other' computers.

By the way: it is PowerPoint 2003.

Frans van Zelm
 
F

F.H. van Zelm

Hi Steve,

I already apologized in my reaction to Edward. Probably my frustration was
in the way.

Frustration because I'm still stuck with characters from Keystrokes MT that
I inserted by Insert-Symbol.
And I did that hundreds of times.

It looks like the code overlooks these characters. Or am I wrong again?

Frans
 
F

F.H. van Zelm

Hi Steve,

I must have done both (from the regular grid and from recently used), over
the years. But not one character is found.
Eh, to tell the truth: I made a source presentation with often used
'characters' (arrows, smilies etc.) and copy them from there into the
working presentation.

In File-Save As-Tools-Options the check for 'Embed TrueType fonts' is on
with the option 'Embed characters in use only'. Keystrokes MT seems to be a
restricted font.

Even more confusing: Format-Replace Fonts ... indicated that fonts
- Arial Unicode MS - Arial
- Courier New - Desdemona
- Keystrokes MT - Wingdings (and W2 and W3)
- Marlett - Matura MT Script Capitals
- Monotype Sorts - Symbol
- Times New Roman - Typographic Ext
are in use. My code (below) only finds Matura ...
I already created a parallel macro to check the notespages.

Your attention is appreciated highly!
If you are interested: the ugly presentation is on www.fhvzelm.com -
[Presentations] - [The files] and there Access.ppt.
It has some 1500 slides so you can imagine, I'm happy to clean this mess
manually.

Frans
=================
Sub FontsUsedOnSlide()
Dim mySlide As Slide
Dim myShape As Shape
Dim myTellerSlides As Integer
Dim myTellerShapes As Integer
Dim myTellerCharacters As Integer
On Error Resume Next
For Each mySlide In ActivePresentation.Slides
myTellerSlides = myTellerSlides + 1
For Each myShape In mySlide.Shapes
myTellerShapes = myTellerShapes + 1
' If myShape.Type = msoPlaceholder Then
For myTellerCharacters = 1 To
myShape.TextFrame.TextRange.Characters.Count
With
myShape.TextFrame.TextRange.Characters(myTellerCharacters).Font
If .Name <> "Times New Roman" And .Name <> "Arial" Then
Debug.Print myTellerSlides & " - " & myTellerShapes & " - " &
myTellerCharacters & " - " & .Name
' ActivePresentation.Slides(myTellerSlides).Select
End If
End With
Next
' End If
Next
myTellerShapes = 0
Next
End Sub
=========================

Steve Rindsberg said:
But ... (sorry), it is getting complex:
- Keystrokes MT and Almanac MT are found by your code if typed after
change
of font (Format-Font, choose font, [OK] and 'type').
- Keystrokes MT and Almanac MT are not found when inserted as symbol
(Insert-Symbol, choose font, charachter and [Insert]).

Are you choosing the character from the list of recently used characters
at the
bottom of the Insert Symbol dialog box? PPT may be inserting symbols from
a
different font in that case, and there can be other odd side effects.

Is Keystrokes MT embeddable? Saving the presentation with fonts embedded
might
solve your problem.


- other fonts are found after inserting either way, even Brush Script MT.
- and all fonts, either way, are found by Format-Replace Fonts so ... PPt
itself does the trick but without any user control.

And, as you will guess, I used Insert-Symbols-Keystrokes MT ;-(. Many
times
in huge presentations (> 1000 slides).
And this font prevents using these presentations on 'other' computers.



By the way: it is PowerPoint 2003.

Frans van Zelm


==============================
PPT Frequently Asked Questions
http://www.pptfaq.com/

PPTools add-ins for PowerPoint
http://www.pptools.com/

Don't Miss the PPTLive User Conference! Atlanta | Oct 11-14
 
E

Edward

In your code ,you only check text inside placeholders
if myShape.Type = msoPlaceholder
change it to
if myShape.HasTextFrame then

This way your code will check all the shapes that have textframe .

You can also do a quick check . Insert a textbox with a text, and insert
Keystrokes MT character , then run the VBA code to output the font name , now
you can check to see what VBA prints out for the font name . I really have
doubt that VBA can not recognize any specific font name!
 
F

F.H. van Zelm

Hi Edward,

I changed my code according to your advice (thanks) to make the search more
general.

And as you suggested, I did various tests:
The result:
- Keystrokes MT is found in placeholders and textboxes after Format-Font,
change to K MT and 'type'.
- Keystrokes MT is not found nowhere if inserted by Insert-Symbol, select K
MT and character and [Insert].
- Other fonts e.g. Arial, Arial Unicode MS and Script MT Bold is found
always.

The sad thing is that, over the years and in hundreds of slides, I inserted
these characters by Insert-...

Also Format-Replace Fonts ... mentions 13 fonts used (e.g. Windings, W2 and
W3) whereas the code only finds three of them.

I am very pleased that you gave / give me support.

Frans van Zelm
 
F

F.H. van Zelm

Hi John,

You're quite right!

Keystrokes MT and also Almanac MT and Holidays MT don't show in the font box
of the Formatting toolbar if done by Insert-Symbol.
Same goes for e.g. Wingdings (and 2 and 3), Monotype Sorts and Typographic
Ext and Marlett. These are all 'iconized' fonts.

But they are shown after a 'regular' change of font. All (?) other fonts do.
And Format-Replace Fonts ... finds all fonts used in either way.

However: a copy of inserted charachters from PowerPoint to Word stands: you
get the icons. After a change of font, the copied characters lose the icon
face. How come ...?

My misery: I inserted hundreds of these iconized characters. How to tell my
VBA to locate them ... It puzzles me.

Frans
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top