Visual Basic - Ayuda FileListBox / Abrir Archivo

Life is soft - evento anual de software empresarial
 
Vista:

Ayuda FileListBox / Abrir Archivo

Publicado por Mariano (5 intervenciones) el 01/10/2009 23:30:48
Hola gente, como andan?

tengo un problema para abrir un archivo (xls) luego de haberlo seleccionado con el FileListBox.

O sea, quiero apretar un botón y que me abra el archivo seleccionado.

El código que tengo cargado es el siguiente:

Dim ruta As String
ruta = File1.Path & "/" & File1.FileName
Open ruta For Input As #1

No se si está bien.

Si pueden darme una mano, se los agradezco.

Saludos.
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:Ayuda FileListBox / Abrir Archivo

Publicado por juan carlos (518 intervenciones) el 02/10/2009 08:22:16
intentalo asi Mariano
Private Sub Command1_Click()
r = Chr(13) & Chr(10)
Dim archivo
if len(dir1) = 3 then
ruta = File1.Path & File1.FileName
archivo = FreeFile
Open ruta For Input As archivo
Do While Not EOF(archivo)
Line Input #archivo, Txt
Text1 = Text1 & r & Txt
Loop
Close archivo
elseif len(dir1) > 3 then
ruta = File1.Path & "\" & File1.FileName
archivo = FreeFile
Open ruta " For Input As archivo
Do While Not EOF(archivo)
Line Input #archivo, Txt
Text1 = Text1 & r & Txt
Loop
Close archivo
end if
End Sub
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar