Saltar al contenido
View in the app

A better way to browse. Learn more.

Ayuda Excel

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Abrir archivo externo

publicado

Los datos que tengo fijos son:

ruta = ActiveWorkbook.Path & "\Archivos\"

Archivo="2021-11-22-4-1"

La extension del archivo No es fija, puede ser (XLS, DOC, PPT) pero solo hay uno con ese nombre

Pregunta: Que instrucción debo de escribir para que abra el archivo

Gracias

Featured Replies

publicado
Hace 2 horas, Janlui dijo:

La extension del archivo No es fija, puede ser (XLS, DOC, PPT) pero solo hay uno con ese nombre

si no conoces la EXTension, (probablemente) lo mejor es un hipervinculo ?:

Sub abrirArchivo()
  Dim ruta As String, archivo As String, objetivo As String
  ruta = ThisWorkboook.Path & "\archivos\"
  archivo = "2021-11-22-4-1"
  objetivo = Dir(ruta & archivo & ".*")
  If objetivo <> "" Then ThisWorkbook.FollowHyperlink ruta & objetivo
End Sub

quiza obtendras una alerta por potencial riesgo abriendo ese tipo de enlaces (?)

publicado

Una alternativa a los hipervínculos:

Const xls As String = ".xls"
Const doc As String = ".doc"
Const ppt As String = ".ppt"

Sub AbrirVariable(): On Error Resume Next
Dim x As Object, Archivo As String
'--
Archivo = ActiveWorkbook.Path & "\Archivos\2021-11-22-4-1" '<------
'--
If Not Dir(Archivo & xls) = "" Then
   With CreateObject("Excel.Application")
      .Workbooks.Open Filename:=Archivo & xls
      .Visible = True
      .Activate
   End With
End If
'--
If Not Dir(Archivo & doc) = "" Then
   With CreateObject("Word.Application")
      .Documents.Open Filename:=Archivo & doc
      .Visible = True
      .Activate
   End With
End If
'--
If Not Dir(Archivo & ppt) = "" Then
   With CreateObject("PowerPoint.Application")
      .Presentations.Open Filename:=Archivo & ppt
      .Visible = True
      .Activate
   End With
End If
Set x = Nothing
End Sub

 

publicado
  • Autor

Estimados, hice pruebas con lo que me proporcionaron y obtuve el objetivo de esta manera.

 

Sub Abrir_File()
    ruta = ActiveWorkbook.Path & "\Archivos\"
    archivo = "2021-11-23-4-1.*"
    FilePath = Dir(ruta & archivo)
    ThisWorkbook.FollowHyperlink ruta & FilePath
End Sub

Gracias por su colaboración.

Archivado

Este tema está ahora archivado y está cerrado a más respuestas.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.