Create a Shortcut in ms access vba

I would like to create a shortcut in vba to install fonts here's the info

argument=C:\myfolder\myfolder1\myfolder2\RegisterFont.exe add TEXASLED.ttf bold_led_board-7.ttf Codystar-Regular.ttf Codystar-Light.ttf enhanced_led_board-7.ttf
tagetpath=C:\myfolder\myfolder1\myfolder2

the program name is RegisterFont.exe located in the C:\myfolder\myfolder1\myfolder2 folder
thanks
SvgmassiveAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

Bill PrewCommented:
Are you looking for a shortcut (.LNK file) to be created so that the user can double click on it and it will run that EXE program with those parms?  If so, do you want the .LNK file located on the Desktop, or actually placed in the same folder as the EXE (C:\myfolder\myfolder1\myfolder2)?

If trying to create a shortcut on the desktop to launch that program then try this:

Sub CreateShortcut()
    Dim objShell As Object

    Dim myCommand As String
    Dim myParms As String
    Dim myFolder As String

    myCommand = "C:\myfolder\myfolder1\myfolder2\RegisterFont.exe"
    myParms = "add TEXASLED.ttf bold_led_board-7.ttf Codystar-Regular.ttf Codystar-Light.ttf enhanced_led_board-7.ttf"
    myFolder = "C:\myfolder\myfolder1\myfolder2"
    
    Set objShell = CreateObject("WScript.Shell")
    
    With objShell.CreateShortcut(objShell.SpecialFolders("Desktop") & "\AddFont.lnk")
        .Targetpath = myCommand
        .Arguments = myParms
        .WorkingDirectory = myFolder
        .Save
    End With

    Set objShell = Nothing
End Sub

Open in new window


»bp
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
PatHartmanCommented:
I don't understand why you would need to create a shortcut to install the fonts.  Why not just install them.  It would make sense to create a shortcut if this were something that needed to be run regularly but once the fonts are installed, they are installed and there would be no further use for the shortcut.
1
PatHartmanCommented:
Svgmassive, you endorsed my comment.  Does that mean that you are trying to close the question?
0
SvgmassiveAuthor Commented:
I tested on 32bit just wanted to ensure that it worked on 64bit.
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
Microsoft Access

From novice to tech pro — start learning today.