why VBA dosn't recognize all the fonts?

  • Thread starter Thread starter Edward
  • Start date Start date
E

Edward

Hi everybody,
Im wrting a vba code to check font names in my presentation and see if they
match allowable fonts but for some reason VBA can't recognize all the fonts ,
somthing that never happened in word VBA!


Dim oSld As Slide
Dim oShp As Shape

For Each oSld In ActivePresentation.Slides
For Each oShp In oSld.Shapes
If oShp.HasTextFrame Then
If oShp.TextFrame.HasText Then
ilast=oshp.textframe.textrange.words.count
for iindex=1 to ilast
if oshp.textframe.textrange.words(iindex).font.name="Gothic"
then
' do somthing
end if
next
End If
End If
Next oShp
Next oSld
 
Thanks steve, I use PPT 2003 but apparently as you mentioned 2007 has the
same issue too. I tried to use debug.print and print font names in different
textplace holders and guess what ! it just printed blank for some fonts and
printed the correct name for the rest ! . I came up with a soulution which
seems to work at least for now I added a userform with some lables which does
word count and some extra stuff and copied each words font name to a lable's
font name and compared that name with my target font name and so far it does
the comparision correctly something that failed when I tried to do in VBA
directly !!
 
Thanks Steve . I was very careful not to apply several fonts to each word but
I will use your suggestions , Thanks again for your time and great help :)
 
Back
Top