Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

VBscript to VBA shell commands help

Status
Not open for further replies.

mustangcoupe

Technical User
Feb 26, 2003
221
US
I got this from a diffrent froum. I am looking to check the font directory see if my font(3of9) exists and if it dosn't create it... If it does then do nothing...

I dont know shell commands at all... is this the best way to do it is this the correct correct commands/syntax for vba


Code:
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

--Todd


TechnicalUser pretending to be a programmer(shhh… the boss doesn’t know yet)
 
It looks syntactically correct in the portion of code that you posted. You should have other code before this to Dim the FSO and WSH object that you are using. You will also need a reference to the windows scripting runtime library.

[red]"... isn't sanity really just a one trick pony anyway?! I mean, all you get is one trick, rational thinking, but when you are good and crazy, oooh, oooh, oooh, the sky is the limit!" - The Tick[/red]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top