Ayuda con shell
Hola, estoy haciendo un simple programa para ejecutar un proceso pero no puedo ejecutar un archivo no se que pasa, gracias.
EL CODIGO QUE USO ES:
Private Sub Command1_Click()
nombre = Dir1.Path & File1.FileName
a = Shell (nombre)
End Sub
Private Sub Dir1_Change()
File1.Path = Dir1.Path
End Sub
Private Sub Drive1_Change()
On Error GoTo sol
Dir1.Path = Drive1.Drive
File1.Path = Dir1.Path
Exit Sub
sol:
If Err.Number = 68 Then
MsgBox ("El dipositivo no se encuentra disponible.")
Dir1.Path = "c:"
Drive1.Drive = "c:"
End If
Exit Sub
End Sub
Me da error numero 5 "Llamada a procedimiento o argumento no válidos.
Gracias chau
EL CODIGO QUE USO ES:
Private Sub Command1_Click()
nombre = Dir1.Path & File1.FileName
a = Shell (nombre)
End Sub
Private Sub Dir1_Change()
File1.Path = Dir1.Path
End Sub
Private Sub Drive1_Change()
On Error GoTo sol
Dir1.Path = Drive1.Drive
File1.Path = Dir1.Path
Exit Sub
sol:
If Err.Number = 68 Then
MsgBox ("El dipositivo no se encuentra disponible.")
Dir1.Path = "c:"
Drive1.Drive = "c:"
End If
Exit Sub
End Sub
Me da error numero 5 "Llamada a procedimiento o argumento no válidos.
Gracias chau
haz esto pega en el form:
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
Const SW_NORMAL = 1
y elcambialo asi
Private Sub Command1_Click()
Dim nombre As String
nombre = Dir1.Path & "\" & File1.FileName
Dim X
X = ShellExecute(Me.hwnd, "Open", nombre, &O0, &O0, SW_NORMAL)
End Sub
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
Const SW_NORMAL = 1
y elcambialo asi
Private Sub Command1_Click()
Dim nombre As String
nombre = Dir1.Path & "\" & File1.FileName
Dim X
X = ShellExecute(Me.hwnd, "Open", nombre, &O0, &O0, SW_NORMAL)
End Sub
