![]() |
|
|
Thread Tools | Display Modes |
#1
|
||||
|
||||
![]()
Hi,
I am a novice VBA user. I have about 300 files I need to process. I would like to apply a macro to all the files. When the Files are in a standard folder I can use the macro below. It works perfectly. It finds the files of a .docx type and applies a macro to it. I now need help with a macro that will go through all the subfolders in the directory and apply my macro. I have tested many versions of loop through directory VBA codes and have had no luck in getting the codes to work. Sub ApplyMacroToAllFiles() Dim file Dim path As String path = "C:\Users\\Desktop \Folder\" file = Dir(path & "*.docx") Do While file <> "" Documents.Open FileName:=path & file Call RemoveallBoldWords ActiveDocument.Save ActiveDocument.Close ' Set file to next in Dir file = Dir() Loop End Sub I simply need to be able to process the documents in the sub folders. If any one can help me I would be so grateful. I have spent 2 days testing different VBA directory loop codes from the internet with no success. I get run time errors, no response from the macro. It's really frustrating. Thank you in advance J |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
Peter Carter | Word VBA | 27 | 12-15-2022 04:10 PM |
Help - Need Macro to Apply Blur | SSL | PowerPoint | 6 | 07-26-2015 08:59 AM |
.wda file extension added after .pdf, .docx, .xls, etc. | GaryofLG | Outlook | 1 | 06-07-2015 11:13 PM |
![]() |
ubns | Word | 1 | 08-02-2012 04:09 AM |
![]() |
Catalin.B | Excel Programming | 2 | 09-08-2011 11:37 PM |