Solved

distribute font (from access VBA)

Posted on 2004-10-22
390 Views
Last Modified: 2013-12-03
I need to distribute a font (from access VBA) the fomt is 3of9 barcode font...  I would like to on open of the application or frmsplash (first form) check to see if the font is present.  if not install it.
0
Question by:mustangcoupe
    11 Comments
     

    Author Comment

    by:mustangcoupe
    maybe using the shell commands?  But I dont know enough abou them....
    0
     
    LVL 4

    Expert Comment

    by:Beldoran
    Some vbscript I cut from another page, I forgot to note the url though, sorry.

    Set WSHShell = CreateObject("WScript.Shell")
    set FSO = CreateObject("Scripting.FileSystemObject")

    sFontName = "sample.ttf"
    sFontDescription = "Sample Font (TrueType)"

    FSO.Copyfile "c:\" + sFontName, "c:\windows\fonts\" + sFontName
    WSHShell.RegWrite "HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Fonts\" + sFontDescription, sFontName

    (This is vbscript, I am not certain what modifications you will need to make for access VBA, but shouldn't be too much)
    0
     

    Author Comment

    by:mustangcoupe
    thanks Beldoran

    does anyone else knoe how I would rewrite this in VBA ( also generic for OS  if possiable, running win2000 and XP)
    0
     

    Author Comment

    by:mustangcoupe
    Beldoran, do you have anymore of the code or do you remember where to find it?  I need to dim the functions.
    0
     
    LVL 4

    Expert Comment

    by:Beldoran
    The functions are windows script host functions and should be directly accessable without extra definitions

    You may want to define the variables used though

    Dim WSHShell as object
    Dim FSO as object
    Dim sFontName, sFontDescription as string

    The Microsoft notes on these functions are (note the scripting version is often much better documentation)

    Regwrite
    scripting version http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/wsMthRegWrite.asp

    Copyfile
    VBA version http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vbenlr98/html/vamthCopyFile.asp
    scripting version http://msdn.microsoft.com/library/default.asp?url=/library/en-us/script56/html/jsmthcopyfile.asp
    0
     
    LVL 4

    Expert Comment

    by:Beldoran
    note, The code above works as is in a .vbs file that was all there was. I was going to use it in a domain logon script to install some fonts.

    0
     
    LVL 4

    Expert Comment

    by:Beldoran
    sorry for the many additions to this but I keep thinking of things.

    The WSH - windows script host is available in 2000 and xp it is also installed (I think with later versions of IE) so should be generic.

    Bel
    0
     

    Author Comment

    by:mustangcoupe
    Thanks but I beleive I found an answer to my problems....  http://www.accessvba.com/showthread.php?s=&threadid=9623&goto=nextoldest
    0
     
    LVL 4

    Expert Comment

    by:Beldoran
    Excellent, well done, they are using the windows API directly. That would work as well.
    0
     

    Author Comment

    by:mustangcoupe
    The only thing I would add is that you have to add the file to the table before opening the database... do in the case of my font I added a 3of9.ttf to the table (and checked the register font) and then when it opened it loaded the font as an ole object.  and then deleated the font from the directory on the unload cmd.... but it does "create it" when the file loads!
    0
     

    Accepted Solution

    by:
    PAQed with points refunded (125)

    modulo
    Community Support Moderator
    0

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone. Privacy Policy Terms of Use

    Featured Post

    IT, Stop Being Called Into Every Meeting

    Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

    Suggested Solutions

    Here we come across an interesting topic of coding guidelines while designing automation test scripts. The scope of this article will not be limited to QTP but to an overall extent of using VB Scripting for automation projects. Introduction Now…
    Entering a date in Microsoft Access can be tricky. A typo can cause month and day to be shuffled, entering the day only causes an error, as does entering, say, day 31 in June. This article shows how an inputmask supported by code can help the user a…
    Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
    In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

    877 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now