Hi all, I have the following code:
Before you say anything about using an alternative, I need to use the shell command rather than application.hyperlink or shellExecute as these two commands don't work in a few of the cases. (I have tried
)
Anyway, basically I am trying to open a program and file with it too. But all I can get at the moment is an open program.
Also,
For some reason, the message box for strWholeFile (only using a msgbox for debugging purposes) is returning nothing in the variable, so for some reason it's not getting information delivered into it, which is bizarre as it should be.
I'd appreciate your help, mainly with the syntax for Shell()
another version I'd tried was
but that didn't work, so I tried putting the two Me.ProjectPath and Me.lstboxProjectFiles and the back slash into a single variable for simplicity when calling. As shown in the first code listing.
"Me.ProjectPath" is the path name for where the file is stored, not including a backslash or the file itself.
"Me.lstboxProjectFiles" is the listbox where all the filenames are shown and depending on the filename clicked, the file name will change
Edit:
I've also just tried this but to no avail:
Code:
Private Sub lstboxProjectFiles_DblClick(Cancel As Integer)
Dim strWholePath As String
Call getextension(Me.lstboxProjectFiles)
If getextension(Me.lstboxProjectFiles) = "nbp" Then
strWholePath = Me.ProjectPath & "\" & Me.lstboxProjectFiles
MsgBox "This is the data in strWholeFile ' " & strWholeFile & " ' ", vbOKOnly
Shell ("c:\Program Files\Norsonic\NorBuild\NorBuild.exe & strWholePath")
ElseIf getextension(Me.lstboxProjectFiles) = "CMG" Then
strWholePath = Me.ProjectPath & "\" & Me.lstboxProjectFiles
MsgBox "This is the data in strWholeFile ' " & strWholeFile & " ' ", vbOKOnly
Shell ("c:\program files\01dB\01dB Software\dBBati32.exe & strWholePath")
'ElseIf getextension(Me.lstboxProjectFiles) = "DWG" Or "DXF" Then
'shell ("c:\program files
Else
Call GoHyperlink(Me.ProjectPath & "\" & Me.lstboxProjectFiles)
'Application.FollowHyperlink Me.ProjectPath & "\" & Me.lstboxProjectFiles
' nDT = GetDesktopWindow()
' nApp = ShellExecute(nDT, "Open", Me.ProjectPath & "\" & Me.lstboxProjectFiles, "", "C:\", SW_SHOWNORMAL)
' DoEvents
End If
End Sub

Anyway, basically I am trying to open a program and file with it too. But all I can get at the moment is an open program.
Also,
For some reason, the message box for strWholeFile (only using a msgbox for debugging purposes) is returning nothing in the variable, so for some reason it's not getting information delivered into it, which is bizarre as it should be.
I'd appreciate your help, mainly with the syntax for Shell()
another version I'd tried was
Code:
Private Sub lstboxProjectFiles_DblClick(Cancel As Integer)
Dim strWholePath As String
Call getextension(Me.lstboxProjectFiles)
If getextension(Me.lstboxProjectFiles) = "nbp" Then
Shell ("c:\Program Files\Norsonic\NorBuild\NorBuild.exe Me.ProjectPath" & "\" & Me.lstboxProjectFiles)
ElseIf getextension(Me.lstboxProjectFiles) = "CMG" Then
Shell ("c:\program files\01dB\01dB Software\dBBati32.exe Me.ProjectPath" & "\" & Me.lstboxProjectFiles)
'ElseIf getextension(Me.lstboxProjectFiles) = "DWG" Or "DXF" Then
'shell ("c:\program files
Else
Call GoHyperlink(Me.ProjectPath & "\" & Me.lstboxProjectFiles)
'Application.FollowHyperlink Me.ProjectPath & "\" & Me.lstboxProjectFiles
' nDT = GetDesktopWindow()
' nApp = ShellExecute(nDT, "Open", Me.ProjectPath & "\" & Me.lstboxProjectFiles, "", "C:\", SW_SHOWNORMAL)
' DoEvents
End If
End Sub
"Me.ProjectPath" is the path name for where the file is stored, not including a backslash or the file itself.
"Me.lstboxProjectFiles" is the listbox where all the filenames are shown and depending on the filename clicked, the file name will change
Edit:
I've also just tried this but to no avail:
Code:
Shell ("c:\Program Files\Norsonic\NorBuild\NorBuild.exe Me.ProjectPath & chr(34)\chr(34) & Me.lstboxProjectFiles")
Last edited: