Change the FONT (NAME) using a combo box

homer2002

Registered User.
Local time
Today, 03:29
Joined
Aug 27, 2002
Messages
152
Can i get a list of all the fonts available and store this in a

combo/list box, array, anything really.


All I need is a list of the names.


i.e.
"courier"
"comic"


(but obviously I need the list from the PC and not just a list of fonts :D)



It would be really handy
 
Last edited:
This is probably not the best way to go about it but, you can use the fileSystemObject to read the contents of folders.

this script populates a text field (textCheck) with all the files in a folder using the OnClick event

Private Sub CheckImport_Click()
Dim FileName As String
Dim objFSO
Dim objFolder
Dim objFile

Me.textCheck = Null

Set objFSO = CreateObject("Scripting.FileSystemObject")
Set objFolder = objFSO.GetFolder("C:\WINDOWS\Fonts")

For Each objFile In objFolder.Files
Me.textCheck = Me.textCheck & objFile.Path & vbCrLf
DoCmd.RepaintObject acForm, "ImportForm"
Next
End Sub
 
Thanks, thats the way I tried originally.

thing is, that returns the filename of the font (which is different to the FONT NAME).

Unless I can figure out a way of using the filename instead.

Pity I can't just use.



lblALabel.FontName = "C:\WINNT\FONT\Myfont.ttf"
 
Might have been an idea to tell me that before I wasted my time writing an answer...........?:mad:
 
I thought that would have been obvious by the lines

_________________________________
All I need is a list of the names.


i.e.
"courier"
"comic"
___________________________________

as opposed to

All I need is a list of the filenames.

i.e
"cour1.ttf"
"MSsereif.ttf"
 
There's absolutly no indication there that you tried to use the fileSystemObject to get the file names.

I didn't test the code first, it's just supposed to be pointing you in a direction that help you.

As it happens Fonts are a bit wierd the way their displayed in explorer, they display the font name and not the file name. I would imagine you can probably get the font name by using a variation of the method i suggested
 

Users who are viewing this thread

Back
Top Bottom