Hey there,

I'd like to get some ideas from ya'all

I have one code for open files from a folder and calling a macro from other workbook and then save it to the same folder.


Sub OpenFiles()
Dim MyFolder As String
Dim MyFile As String
MyFolder = "c:\test\"
MyFile = Dir(MyFolder & "\*.xlsm")

Do While MyFile <> ""
Workbooks.Open fileName:=MyFolder & "\" & MyFile

Application.Run ("'Weekly Sales Report.xlsm'!formulas_auto_refresh_manual")

MyFile = Dir
ActiveWorkbook.Close SaveChanges:=True
Workbook.Close fileName:=MyFolder & "\" & MyFile

Loop

End Sub



The files were able to opened and saved respectively but the macro of 'formulas_auto_refresh_manual' was failed which is as following


Sub formulas_auto_refresh_manual()

Dim sh As Workbook

Application.Calculation = xlAutomatic
'Do Something
'Recalc
Calculate
' refresh data
Application.CalculateFullRebuild
ActiveWorkbook.RefreshAll
'Recalc
Calculate
'Do More Things
Application.Calculation = xlManual

End Sub


Could anyone help me solve this issue?

Many many thanks!!