Abrir carpeta con macro en excel
Busqué por Todoexpertos una macro y la encontré, sin embargo, no me funciona. Cuando le doy depurar me selecciona la línea de call shell y no ejecuta... No sé qué pueda estar mal.
Sub EVO()
Dim num As Variant
Dim FileSystemInstancia
Dim base2 As String, Namek As String
Dim ruta As String, ruta3 As String
'Ambiente
Application.ScreenUpdating = False
Application.DisplayAlerts = False
'
ruta = Environ("USERPROFILE") & "\Dropbox\DOCUMENTOS PERSONALES\CONSULTORIO\hISTORIAS CLINICAS\HC-CONSULTORIO\"
num = Sheets("Ficha").Range("F2").Value
'datos para la carpeta
Sheets("Ficha").Select
base2 = Cells(4, "F") & " " & Cells(4, "G") & " " & Cells(4, "C") & " " & Cells(4, "D") & "-" & num
ruta3 = ruta & base2
'Folder crear o encontrar
Set FileSystemInstancia = CreateObject("Scripting.FileSystemObject")
If Not FileSystemInstancia.FolderExists(ruta3) Then
MsgBox ("No hay evoluciones")
Else
Call Shell("explorer.exe" & ruta3, vbNormalFocus)
End If
End SubMás adelante quisiera otra macro que me hiciera el mismo proceso pero me abriera una subcarpeta en la anterior.
Sub EXA()
Dim num As Variant
Dim Carpeta As Object
Dim base2 As String, Namek As String
Dim ruta As String, ruta3 As String
Dim Folder As String
Dim FileSystemInstancia
'Ambiente
Application.ScreenUpdating = False
Application.DisplayAlerts = False
'
ruta = Environ("USERPROFILE") & "\Dropbox\DOCUMENTOS PERSONALES\CONSULTORIO\hISTORIAS CLINICAS\HC-CONSULTORIO\"
num = Sheets("Ficha").Range("F2").Value
'datos para la carpeta
Sheets("Ficha").Select
base2 = Cells(4, "F") & " " & Cells(4, "G") & " " & Cells(4, "C") & " " & Cells(4, "D") & "-" & num
ruta3 = ruta & base2
Folder = EXAMENES
'Folder crear o encontrar
Set FileSystemInstancia = CreateObject("Scripting.FileSystemObject")
If Not FileSystemInstancia.FolderExists(ruta3) Then
MsgBox ("No hay exámenes")
Else
Call Shell("explorer.exe" & ruta3 & Folder, vbNormalFocus)
End If
End Sub