Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

295
Vistas
Why can't a macro-enabled workbook be moved to another folder with the "Name As" method in VBA?

The following code attempts to take a macro-enabled (.xlsm) workbook, create a folder with it's name in the same directory where the workbook is located, and then move the workbook into said folder and change its name.

        Dim xlsm_wb         As Workbook
        Dim xlsm_path       As String
        Dim xlsm_name       As String
        Dim fold_path       As String
               
        Set xlsm_wb = Application.Workbooks("repositorio nóminas.xlsm")
            xlsm_path = xlsm_wb.Path
            xlsm_name = xlsm_wb.FullName
            fold_path = xlsm_path & "\repositorio nóminas"
        
        Debug.Print xlsm_name
        Debug.Print fold_path & "\matenimiento.xlsm"
        
        MkDir fold_path                                                    <- Error 75 here 
        Name xlsm_name As fold_path & "\matenimiento.xlsm"                 <- or here

As you can see, I get error 75 in the second-to-last instruction, and if I comment it out and attempt to simply move the .xlsm into the folder without creating it manually, it also gives me the same error.

about 4 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

The reason it is not letting me move the book is that in order to run the macro, the workbook has been opened, and an opened file cannot be moved while being used.

about 4 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda