Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

292
Visualizações
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 Respostas
Responde à pergunta

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 Relatório
Responde à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda