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

the program name is RegisterFont.exe located in the C:\myfolder\myfolder1\myfolder2 folder
Who is Participating?
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 PrewIT / Software Engineering ConsultantCommented:
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
    End With

    Set objShell = Nothing
End Sub

Open in new window


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
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.
Svgmassive, you endorsed my comment.  Does that mean that you are trying to close the question?
SvgmassiveAuthor Commented:
I tested on 32bit just wanted to ensure that it worked on 64bit.
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.