• Hi All

    Please note that at the Chandoo.org Forums there is Zero Tolerance to Spam

    Post Spam and you Will Be Deleted as a User

    Hui...

  • When starting a new post, to receive a quicker and more targeted answer, Please include a sample file in the initial post.

VBA to Save workbook in multiple sub folders

Hi,

I have a workbook named "2020Help". I need to save this file in almost 2000+ folders. folder name is not unique but the subfolder name is "2020help".
is there a way to search the sub folder name and save the file in it.

Any help will be greatly appreciated
 
Possibly...
Code:
Option Explicit
Sub Not_Tested()

'Assumes mulitple folders under sPath,
'a 2020help folder under each of those multiple folders,
'and the .xlsx file to copy in the sPath folder.

    Dim sPath As String
    Dim oFolders As Object
    Dim oFdr As Object
   
    sPath = "c:\temp\"
    With CreateObject("Scripting.FileSystemObject")
        Set oFolders = .getfolder(sPath)
        For Each oFdr In oFolders.subfolders
            .copyfile "c:\temp\2020Help.xlsx", oFdr.Path & "\2020help\2020Help.xlsx"
        Next oFdr
    End With
End Sub
 
Abhishek A
Question: Do those 2000+ folders really need same file in each folder?
or ... could there be a link ... to one folder which has that 2020Help.xlsx -file?
... if You will notice (weekly) that there are missing one 'x' in one cell - then You would need to refresh Your way .. 2000+ files - instead one file.
... if 2000+ same files ... and ... someone would modify 'own'-file ... then there will be soon many versions of that important 'same' -file.
 
Abhishek A
Question: Do those 2000+ folders really need same file in each folder?
or ... could there be a link ... to one folder which has that 2020Help.xlsx -file?
... if You will notice (weekly) that there are missing one 'x' in one cell - then You would need to refresh Your way .. 2000+ files - instead one file.
... if 2000+ same files ... and ... someone would modify 'own'-file ... then there will be soon many versions of that important 'same' -file.
Thank you so much for your input.. its actually a Template and Saving the workbook in all the folder is our job... People will go to each folder and take it forward from there.
 
Back
Top