jwcolby
jwcolby at colbyconsulting.com
Thu Jan 5 07:52:52 CST 2012
I am building an application to Copy files and then open one of the files copied which is an Access application. I have an Access Fe to handle the data entry for setting up the files being copied etc, plus a C# application to handle the actual automation required to do the copy and open. I then point the user to a shortcut to perform this Copy and Open. I found the following code on the internet which allows me to create the shortcut itself programmatically using the information entered into the Access tables. ' ' CreateShellShortcut() ' ' TargetName - The file that would be launched when the shortcut is clicked. ' TargetArguments - Command line parameters to TargetName. ' TargetDescription - The description of the shortcut. ' ShortcutFileName - The shortcut file name including the .lnk extension. ' ' Copyright (C) 2002 OfficeOne ' Sub CreateShellShortcut(ByVal TargetName As String, _ ByVal TargetArguments As String, _ ByVal TargetDescription As String, _ ByVal ShortcutFileName As String) Dim WSH As Object Dim Shortcut As Object Set WSH = CreateObject("WScript.Shell") Set Shortcut = WSH.CreateShortcut(ShortcutFileName) With Shortcut .TargetPath = TargetName .Arguments = TargetArguments .Description = TargetDescription .Save End With Set Shortcut = Nothing Set WSH = Nothing End Sub -- John W. Colby Colby Consulting Reality is what refuses to go away when you do not believe in it