Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 96
Default 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.....


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,718
Default 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.....




Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Add-In Launch MimiS Excel Discussion (Misc queries) 0 May 18th 10 08:42 PM
shortcut has change or move so this shortcut can not open bakerstreet Excel Worksheet Functions 2 April 2nd 10 01:21 PM
xls file will not launch atlantic grouper Excel Discussion (Misc queries) 7 May 7th 09 04:20 PM
File won't launch eric blom Excel Discussion (Misc queries) 1 September 17th 07 10:30 PM
Can't launch Excel [email protected] Excel Discussion (Misc queries) 3 January 2nd 07 02:30 AM


All times are GMT +1. The time now is 06:17 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"