Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 156
Default Detect if font installed- Hiding column


Is it possible to detect programicably
if a certain font is installed ?

I did consider checking the Font folder
and if the font name exists, assume it is present
but there may be a better way.

If the font is missing I'd like to hide a
certain column in the spreadsheet.

Any help appreciated.

Thanks - Kirk
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default Detect if font installed- Hiding column

Lyle Green posted the original code (December 2001) which listed all
fonts in a listbox on a userform. This is my adaptation.
--
Jim Cone
San Francisco, USA
http://www.realezsites.com/bus/primitivesoftware


Sub ShowInstalledFonts()
' Jim Cone - San Francisco - September 2006
Dim FontCtrl As CommandBarControl
Dim i As Long
Dim strFont As String
Dim strArry() As String
Dim strName As String
Dim varResult As Variant

strFont = "DearTeacher-Normal"
Set FontCtrl = Application.CommandBars("Formatting").FindControl( ID:=1728)
ReDim strArry(1 To 1000)

'enters the available installed font names into the array.
'assumes there will not be 2000 fonts.
For i = 1 To FontCtrl.ListCount
strName = FontCtrl.List(i)
strArry(i) = strName
If i 999 Then ReDim Preserve strArry(1 To 2000)
Next ' i

varResult = Application.Match(strFont, strArry, 0)
If Not IsError(varResult) Then
MsgBox strArry(varResult) & " was found. "
Else
MsgBox strFont & " is not installed "
End If
Set FontCtrl = Nothing
End Sub


"kirkm"
wrote in message

Is it possible to detect programicably
if a certain font is installed ?
I did consider checking the Font folder
and if the font name exists, assume it is present
but there may be a better way.
If the font is missing I'd like to hide a
certain column in the spreadsheet.
Any help appreciated.
Thanks - Kirk
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default Detect if font installed- Hiding column

This revision eliminates the need for the ReDim Preserve.
--
Jim Cone
San Francisco, USA
http://www.officeletter.com/blink/specialsort.html

Sub ShowInstalledFonts_R1()
' Jim Cone - San Francisco - September 2006
Dim FontCtrl As CommandBarControl
Dim i As Long
Dim lngCount As Long
Dim strFont As String
Dim strArry() As String
Dim strName As String
Dim varResult As Variant

strFont = "Comic Sans MS"
Set FontCtrl = Application.CommandBars("Formatting").FindControl( ID:=1728)
lngCount = FontCtrl.ListCount
ReDim strArry(1 To lngCount)

'enters the available installed font names into the array.
For i = 1 To lngCount
strName = FontCtrl.List(i)
strArry(i) = strName
Next ' i

varResult = Application.Match(strFont, strArry, 0)
If Not IsError(varResult) Then
MsgBox strArry(varResult) & " was found. "
Else
MsgBox strFont & " is not installed "
End If
Set FontCtrl = Nothing
End Sub

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 156
Default Detect if font installed- Hiding column

Thank you very much, Jim.

Cheers - Kirk

On Mon, 25 Sep 2006 10:54:28 -0700, "Jim Cone"
wrote:

This revision eliminates the need for the ReDim Preserve.

Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Change in Column Width depending on whether printer is installed / SLK Excel Discussion (Misc queries) 1 May 9th 08 05:53 PM
Hiding Column Also hiding text Cindy Excel Programming 0 April 6th 06 07:18 PM
HELP: how to detect if printers are installed? woes :S KevinGPO Excel Worksheet Functions 1 March 14th 06 09:58 AM
HELP: how to detect if printers are installed? woes :S KevinGPO Excel Programming 1 March 14th 06 09:58 AM
Detect what version (if any) of Excel is installed Keith Brautigam Excel Programming 6 April 2nd 04 12:54 AM


All times are GMT +1. The time now is 04:00 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"