Guardar en la carpeta específica
Tengo esta parte de mi macro ( no la adjunto toda porque es muy larga) La parte de crear el folder me funciona, sin embargo, quisiera que si existe no lo creara pero me aparece el "Creado" así ya exista. Por otro lado, quisiera seleccionar esa carpeta para que me exporte el pdf ahi, pero no me exporta el pdf a ningún lado
Sub GB
Dim fbObj As Object
Dim rut as String
Dim num As Variant
Dim Namek As String
num = Worksheets("Ficha").Range("F2").Value
arch = Dir([rut & "*" & num], vbMaximizedFocus)
Namek = rut & Cells(2, "F") & ("-") & Format(Now, "ddmmyyyy") & ".pdf"
rut = Environ("USERPROFILE") & "\Dropbox\DOCUMENTOS PERSONALES\CONSULTORIO\hISTORIAS CLINICAS\"
Set fbObj = CreateObject("Scripting.FileSystemObject")
If fbObj.FolderExists("arch") Then
MsgBox "Encontrado"
Else
fbObj.CreateFolder (rut & Cells(4, "F") & " " & Cells(4, "G") & " " & Cells(4, "C") &" " & Cells(4, "D") & "-" & num)
MsgBox "Creado"
End If
If arch <> "" Then
MsgBox "<" & Namek & ">"
ThisDocument.ExportAsFixedFormat pbFixedFormatTypePDF, Namek
' Cerrar word
WordApp.Quit (True)
Set WordApp = Nothing
Set wdDoc = Nothing
End if
End Sub
1 Respuesta
Respuesta de Dante Amor
