jwcolby
jwcolby at colbyconsulting.com
Thu Jan 5 15:05:27 CST 2012
It is starting to work quite well, at least for me on my workstation. I still need to do testing
using the user workstations.
The key for me was using C# to do the actual automation piece, the copy of the files (easy and
worked in Access) and the startup of the target application, which worked 95% of the time in VBA.
Unfortunately 95% is not good enough. AFAICT performing that automation in C# gives me that 100%
reliability of the automation piece.
John W. Colby
Colby Consulting
Reality is what refuses to go away
when you do not believe in it
On 1/5/2012 11:12 AM, Jim Lawrence wrote:
> Hi John:
>
> I have been following your efforts to create your optimum system and am duly
> impressed with your results.
>
> Jim
>
> -----Original Message-----
> From: accessd-bounces at databaseadvisors.com
> [mailto:accessd-bounces at databaseadvisors.com] On Behalf Of jwcolby
> Sent: Thursday, January 05, 2012 7:08 AM
> To: Access Developers discussion and problem solving
> Subject: Re: [AccessD] Creating a shortcut programmatically
>
> And then a new version to add things I need:
>
> Public Enum ShellWindowStyle
> SWS_None = -1
> SWS_Hide = vbHide
> SWS_MaximizedFocus = vbMaximizedFocus
> SWS_MinimizedFocus = vbMinimizedFocus
> SWS_NormalFocus = vbNormalFocus
> End Enum
>
>
> '
> ' 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
> ' http://support.microsoft.com/kb/244677
> '
> Sub CreateShellShortcut(ByVal TargetName As String, _
> ByVal TargetArguments As String, _
> ByVal TargetDescription As String, _
> ByVal ShortcutFileName As String, _
> WindowStyle As ShellWindowStyle, _
> Optional strWorkingDir As String = "")
>
> Dim WSH As Object
> Dim Shortcut As Object
> 'dim sc as Wscript.shell.
>
> Set WSH = CreateObject("WScript.Shell")
> Set Shortcut = WSH.CreateShortcut(ShortcutFileName)
> With Shortcut
> .TargetPath = TargetName
> .Arguments = TargetArguments
> .Description = TargetDescription
> .WindowStyle = WindowStyle
> If Len(strWorkingDir) Then
> .WorkingDirectory = strWorkingDir
> End If
> .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
>
> On 1/5/2012 8:52 AM, jwcolby wrote:
>> 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
>>
>