La Web del Programador: Comunidad de Programadores
 
    Pregunta:  64987 - ERROR 445
Autor:  guillermo arias
Set fs = Application.FileSearch

With fs
.LookIn = "C:Program FilesComputers and StructuresSAP2000 14"
'.LookIn = "C:"
'.FileName = "sap2000.exe"
If .Execute > 0 Then
'''MsgBox "There were " & .FoundFiles.Count & _
tengo este codigo para abrir una plicacion, pero me un error, por favor me podrian ayudar

'''For i = 1 To .FoundFiles.Count
'MsgBox .FoundFiles(1)
'''Next i
ruta = ThisWorkbook.FullName
todo = "C:Program FilesComputers and StructuresSAP2000 14Sap2000.exe " + ruta
Shell todo, vbHide

Else
'''MsgBox "no se encontraron archivos."
ruta = ThisWorkbook.FullName
todo = "C:Program Files (x86)Computers and StructuresSAP2000 14Sap2000.exe " + ruta
Shell todo, vbHide
End If

  Respuesta:  Gonzalo Quintana
Hola Guillermo:
Si lo que quieres es abrir el archivo Sap2000.exe, deberías utilizar el siguiente código:

Private 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

Dim RuTa as String

RuTa = "C:Program FilesComputers and StructuresSAP2000 14Sap2000.exe"

ShellExecute hwnd, "Open", ruta, "", "", 1

Cualquier cosa, mandame un mail...

Saludos,

Gonzalo