Hello All,
I'm having trouble running a piece of VBA code - centering around the shell command. The code is below:
The file path in the debug.print is showing fine, but it is generating the error "5 Invalid Procedure Call or Arguement"
Can anyone shed any light on why this is happening, or, an alternative to the code above?
Many Thanks
Graham
I'm having trouble running a piece of VBA code - centering around the shell command. The code is below:
Code:
Private Sub cmdOpenFile_Click()
On Error GoTo Errhand
Dim strfilepath As String
strfilepath = Path.Value
Debug.Print strfilepath
Shell strfilepath, vbMaximizedFocus
Errhand:
If Err.Number = 20 Then
Resume Next
ElseIf Err.Number <> 0 Then
MsgBox (Err.Number & " " & Err.Description)
Exit Sub
End If
End Sub
The file path in the debug.print is showing fine, but it is generating the error "5 Invalid Procedure Call or Arguement"
Can anyone shed any light on why this is happening, or, an alternative to the code above?
Many Thanks
Graham