Hi,
I'm trying to get a list of fonts installed on my PC, so my Access application, which is automating Word Mail Merges, can set the font for the desired content.
Currently, the application is working fine, and will change the font size of particular text without issues. Let's say the word document contains text such as:
Code:
Now is the time for all <f:20>good</f> men to come to the aid of their party.
The Access application can successfully find the "<f:20>good</f>" text in the Word document, and convert it to 20 points while removing the surrounding code.
What I now want to do is also change the font and size by having text like this:
Code:
Now is the time for all <f:Courier New:20>good</f> men to come to the aid of their party.
My research shows it's complex to get a list of the font names. I have a form which pops up containing a combo box for the font names, and the user chooses which one, then the form code builds the above text.
Currently I have code which scans files in the C:\Windows\Fonts folder and loads the names into a "fonts" table. Now I have items in the table such as "verdana.ttf" (I've stripped the ".fon" from the end of the file name).
While this is a good way to get a list of fonts, I only have the file name, not the font name as Word would need when I create a Range object and tell it that it's .Font.Name property is "verdana.ttf". This totally doesn't work.
So finally, the question: Is there any way to get the actual Font object out of the font file that I found? Alternatively, if installed font names are listed in the registry, I have code which can enumerate the proper keys and get the "real" names, then load them into my "Fonts" table. Not sure of the proper method.
Does anybody have experience with this issue? Thanks...