Macro que grabe el archivo en una carpeta oculta

Tengo la siguiente macro:

 ActiveWorkbook. Save
    Dim FileWsh As Object
    Set FileWsh = CreateObject("Scripting.FileSystemObject")
    MiVolumen = Hex$(FileWsh.Drives("C").SerialNumber)
    Select Case MiVolumen
        Case "3297E471"
    Application.ScreenUpdating = False
    Application.DisplayAlerts = False
    Sheets("BASE").Visible = True
    Sheets("BASE").Copy
    ruta = "D:\manager\proyects\"
    ActiveWorkbook.SaveAs ruta & "Pacientes.xlsx", FileFormat:=xlOpenXMLWorkbook
    ActiveWorkbook.Close
    Sheets("BASE").Visible = xlVeryHidden
    ruta = "E:\Videos\Dropbox\MisCopias\MisCopias\"
    arch = ActiveWorkbook.Name
    ActiveWorkbook.SaveCopyAs ruta & arch
    Case Else
    End Select
    Set FileWsh = Nothing

Mi inquietud es la siguiente, que instruccion adicional tendria que colocar si adicional a grabar el libro actual con las anteriores instrucciones, yo quisiera que el libro actual se me grabar con el nombre original que es "Agenda Consultorio.xlsm" pero en una carpeta que el sistema la tiene oculta y que la ubicación de dicha carpeta es "D:/Documentos/Programa/"

1 Respuesta

Respuesta
1

Prueba así y me comentas

Sub x()
    ActiveWorkbook.Save
    Dim FileWsh As Object
    Set FileWsh = CreateObject("Scripting.FileSystemObject")
    MiVolumen = Hex$(FileWsh.Drives("C").SerialNumber)
    Select Case MiVolumen
        Case "3297E471"
            Application.ScreenUpdating = False
            Application.DisplayAlerts = False
            Sheets("BASE").Visible = True
            Sheets("BASE").Copy
            ruta = "D:\manager\proyects\"
            ActiveWorkbook.SaveAs ruta & "Pacientes.xlsx", FileFormat:=xlOpenXMLWorkbook
            ActiveWorkbook.Close
            Sheets("BASE").Visible = xlVeryHidden
            ruta = "E:\Videos\Dropbox\MisCopias\MisCopias\"
            arch = ActiveWorkbook.Name
            ActiveWorkbook.SaveCopyAs ruta & arch
            '
            ruta = "D:\Documentos\Programa\"
            ActiveWorkbook.SaveCopyAs ruta & arch
        Case Else
    End Select
    Set FileWsh = Nothing
End Sub

 s a l u d o s

Añade tu respuesta

Haz clic para o

Más respuestas relacionadas