Forum Discussion

hrh_dash's avatar
hrh_dash
Iron Contributor
Oct 17, 2022

Macro execute to loop all word doc files in a folder

How do i amend the code below so that the macro could select all word doc files in the folder? There are no errors but when the code is executed line by line, the macro did not run through the Do Wh...
  • HansVogelaar's avatar
    Oct 17, 2022

    hrh_dash 

    Also, to be on the safe side, I'd explicitly loop through Word documents, so that you don't get an error if the folder contains another type of file:

        path = "C:\Users\hrhquek\Desktop\DEBT RECOVERY\Bizfile\"
        
        myFile = Dir(path & "*.doc*")
    

Resources