Hi Richard, welcome to the forum.
Please post your solution so it may help others.
One option, in case it's different from your method, would be to put the full path/filename into a cell and then use the Worksheet_BeforeDoubleClick event. You can then double-click on that cell and it will open the program and file specified. (Full path/filename like: c:\users\Paul\desktop\diagram.dwg)
1. Add the following to the worksheet code module (right-click on sheet tab and choose View Code):
Private Sub Worksheet_BeforeDoubleClick(ByVal Target As Range, Cancel As Boolean)
Cancel = True
Call mysub(Target.Value)
End Sub
2. Add the following code to a standard module (in the VB Editor, click Insert > Module):
Const SW_SHOW = 1
Const SW_SHOWMAXIMIZED = 3
Public 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
Public Sub mysub(str as String)
Dim RetVal As Long
On Error Resume Next
RetVal = ShellExecute(0, "open", "C:\Program Files\Autocad\autocad.exe", str, "C:\temp", SW_SHOWMAXIMIZED)
End Sub
Change the program path/filename to your actual Autocad program executable path/filename.
Bookmarks