Create a Shortcut in ms access vba

Svgmassive
Svgmassive used Ask the Experts™
on
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
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Test your restores, not your backups...
Top Expert 2016
Commented:
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
Distinguished Expert 2017

Commented:
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.
Distinguished Expert 2017

Commented:
Svgmassive, you endorsed my comment.  Does that mean that you are trying to close the question?

Author

Commented:
I tested on 32bit just wanted to ensure that it worked on 64bit.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial