Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

291
Views
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 answers
Answer question

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 Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!