ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Using vb to launch a shortcut (https://www.excelbanter.com/excel-programming/296091-using-vbulletin-launch-shortcut.html)

JT[_2_]

Using vb to launch a shortcut
 
We have macros that use a legacy program and either
extracts information from or updates info to the legacy
program.

Our instructions always tell the users to OPEN the legacy
program first, before starting the macro. We set the
legacy program as an object and then refer to the object
throughout the macro.

Is there a way for a macro to launch a desktop shortcut or
search for a file name on a PC's hard drive to start the
legacy program? Thanks.....



Jim Rech

Using vb to launch a shortcut
 
This launched a desktop shortcut for me:

Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _
(ByVal hwnd As Long, ByVal lpOperation As String, _
ByVal lpFile As String, ByVal lpParameters As String, _
ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long

Sub LaunchLNK()
Dim DeskTop As String
DeskTop = CreateObject("WScript.Shell").SpecialFolders.Item( "Desktop")
ShellExecute 0, "Open", DeskTop & "\ztree.lnk", "", "C:\", 1
End Sub

--
Jim Rech
Excel MVP
"JT" wrote in message
...
We have macros that use a legacy program and either
extracts information from or updates info to the legacy
program.

Our instructions always tell the users to OPEN the legacy
program first, before starting the macro. We set the
legacy program as an object and then refer to the object
throughout the macro.

Is there a way for a macro to launch a desktop shortcut or
search for a file name on a PC's hard drive to start the
legacy program? Thanks.....






All times are GMT +1. The time now is 03:29 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com