Open Files, Run Macro, Save, Close File

jpsimmon

New Member
Joined
Apr 9, 2015
Messages
28
I have been working on a code to open all files in a folder and run each of their macro, save&close each of them. I have a "Master" file that I am putting it in.
I am getting a sub or fx not defined on my sub routine
Code:
Call UpdateData
part of the code.

The full code is:
Code:
Sub UpdateAll()    Dim folderPath As String
    Dim filename As String
    Dim wb As Workbook
  
    folderPath = "K:\Location\" 
    
    If Right(folderPath, 1) <> "\" Then folderPath = folderPath + "\"
    
    filename = Dir(folderPath & "*.xls")
    Do While filename <> ""
      Application.ScreenUpdating = False
        Set wb = Workbooks.Open(folderPath & filename)
         
      
        Call UpdateData
        
   wb.Close SaveChanges:=True
    filename = Dir
 Loop
  Application.ScreenUpdating = True
End Sub

Help would be awesome, thanks.
 

Excel Facts

Highlight Duplicates
Home, Conditional Formatting, Highlight Cells, Duplicate records, OK to add pink formatting to any duplicates in selected range.
Probably the macro UpdateData is not in the Standard Code Module 1, or does not exist, or could require arguments. Hard to tell.
 
Last edited:
Upvote 0

Forum statistics

Threads
1,214,646
Messages
6,120,718
Members
448,986
Latest member
andreguerra

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top