visor
Publicado por zztop2 (3 intervenciones) el 24/08/2009 14:34:07
hola, tengo este visor y no hay manera de que me funcione bien, me da error , no se ha encontrado el archivo, codigo 2
alguien me ayuda por favor...................
On Error GoTo handle
If Trim(Me.lstImg.Column(Me.lstImg.ColumnCount - 1)) <> "" And Not IsNull(Me.lstImg.Column(Me.lstImg.ColumnCount - 1)) And Me.lstImg.ListCount - 1 >= 0 Then
Path = Application.CurrentDb.Name
sfilename = Split(Path, "")
Path = ""
For i = 0 To UBound(sfilename) - 1
Path = Path & sfilename(i)
Path = Path & ""
Next
If Mid(Me.lstImg.Column(Me.lstImg.ColumnCount - 1), 2, 1) <> ":" And Left(Me.lstImg.Column(Me.lstImg.ColumnCount - 1), 2) <> "\" Then
imagen = Me.lstImg.Column(Me.lstImg.ColumnCount - 1)
Else
imagen = Split(Me.lstImg.Column(Me.lstImg.ColumnCount - 1), "")(UBound(Split(Me.lstImg.Column(Me.lstImg.ColumnCount - 1), "")))
End If
If Left(imagen, 1) = "" Then imagen = Right(imagen, Len(imagen) - 1)
documento = Path & imagen
On Error Resume Next
If FileLen(documento) = 0 Then
MsgBox "Document no trobat", vbOKOnly + vbInformation, "Atención"
Exit Sub
End If
On Error GoTo handle
r = modAPI.ShellExecute(Me.hwnd, "open", CStr(imagen), vbNullString, CStr(Path) & "", SW_SHOWNORMAL)
If r <= 32 Then
MsgBox "No s'ha pogut obrir el fitxer." & vbCrLf & _
"Codi d'error: " & r, vbOKOnly + vbCritical, "Atención"
Exit Sub
End If
If Left(UCase(imagen), 3) = "PDF" Then
r = modAPI.ShellExecute(Me.hwnd, "open", CStr(imagen), vbNullString, Path, SW_SHOWNORMAL)
End If
Else
MsgBox "Seleccioni el document a visualitzar", vbOKOnly + vbInformation, "Atención"
End If
Exit Sub
handle:
MsgBox Err.Source & vbCrLf & Err.Description, "Atención"
End Sub
muxas gracias,,,,,,,,,, sobre todo no entiendo la parte de if mid(xxxxxx,x,x),,,,,,,,
gracias
alguien me ayuda por favor...................
On Error GoTo handle
If Trim(Me.lstImg.Column(Me.lstImg.ColumnCount - 1)) <> "" And Not IsNull(Me.lstImg.Column(Me.lstImg.ColumnCount - 1)) And Me.lstImg.ListCount - 1 >= 0 Then
Path = Application.CurrentDb.Name
sfilename = Split(Path, "")
Path = ""
For i = 0 To UBound(sfilename) - 1
Path = Path & sfilename(i)
Path = Path & ""
Next
If Mid(Me.lstImg.Column(Me.lstImg.ColumnCount - 1), 2, 1) <> ":" And Left(Me.lstImg.Column(Me.lstImg.ColumnCount - 1), 2) <> "\" Then
imagen = Me.lstImg.Column(Me.lstImg.ColumnCount - 1)
Else
imagen = Split(Me.lstImg.Column(Me.lstImg.ColumnCount - 1), "")(UBound(Split(Me.lstImg.Column(Me.lstImg.ColumnCount - 1), "")))
End If
If Left(imagen, 1) = "" Then imagen = Right(imagen, Len(imagen) - 1)
documento = Path & imagen
On Error Resume Next
If FileLen(documento) = 0 Then
MsgBox "Document no trobat", vbOKOnly + vbInformation, "Atención"
Exit Sub
End If
On Error GoTo handle
r = modAPI.ShellExecute(Me.hwnd, "open", CStr(imagen), vbNullString, CStr(Path) & "", SW_SHOWNORMAL)
If r <= 32 Then
MsgBox "No s'ha pogut obrir el fitxer." & vbCrLf & _
"Codi d'error: " & r, vbOKOnly + vbCritical, "Atención"
Exit Sub
End If
If Left(UCase(imagen), 3) = "PDF" Then
r = modAPI.ShellExecute(Me.hwnd, "open", CStr(imagen), vbNullString, Path, SW_SHOWNORMAL)
End If
Else
MsgBox "Seleccioni el document a visualitzar", vbOKOnly + vbInformation, "Atención"
End If
Exit Sub
handle:
MsgBox Err.Source & vbCrLf & Err.Description, "Atención"
End Sub
muxas gracias,,,,,,,,,, sobre todo no entiendo la parte de if mid(xxxxxx,x,x),,,,,,,,
gracias
Valora esta pregunta


0