Hi,
Here is a code:
Firstly the above code is supposed to open Macro1 of
and it does that.
Secondly it was also expected to open Macro1 of
but it doesn't even open the file varNames2 = Array("FIRST - Copy\GRAND EVALUATIONS.xlsm").
Please provide me with some solutions to solve this problem.
Thank you
Here is a code:
Code:
[COLOR=#333333]Private Sub CommandButton1_Click()
Dim varNames1 As Variant
Dim varNames2 As Variant
Dim lngArr As Long
Dim wb As Workbook
varNames1 = Array("FIRST\GRAND EVALUATIONS.xlsm")
For lngArr = LBound(varNames1) To UBound(varNames1)
Set wb = Workbooks.Open(ThisWorkbook.Path & "\" & varNames1(lngArr))
Application.Run "'GRAND EVALUATIONS.xlsm'!Macro1"
wb.Close True
Set wb = Nothing
Next lngArr
varNames2 = Array("FIRST - Copy\GRAND EVALUATIONS.xlsm")
For lngArr = LBound(varNames2) To UBound(varNames2)
Set wb = Workbooks.Open(ThisWorkbook.Path & "\" & varNames2(lngArr))
Application.Run "'GRAND EVALUATIONS.xlsm'!Macro1"
wb.Close True
Set wb = Nothing
Next lngArr
ActiveWorkbook.Save
ActiveWorkbook.Close
End Sub
[/COLOR]
Firstly the above code is supposed to open Macro1 of
Code:
[COLOR=#333333]varNames1 = Array("FIRST\GRAND EVALUATIONS.xlsm")
[/COLOR][COLOR=#333333]For lngArr = LBound(varNames1) To UBound(varNames1)[/COLOR]
[COLOR=#333333] Set wb = Workbooks.Open(ThisWorkbook.Path & "\" & varNames1(lngArr))[/COLOR]
[COLOR=#333333] Application.Run "'GRAND EVALUATIONS.xlsm'!Macro1"[/COLOR]
[COLOR=#333333] wb.Close True[/COLOR]
[COLOR=#333333] Set wb = Nothing[/COLOR]
[COLOR=#333333]Next lngArr[/COLOR]
and it does that.
Secondly it was also expected to open Macro1 of
Code:
[COLOR=#333333]varNames2 = Array("FIRST - Copy\GRAND EVALUATIONS.xlsm")
[/COLOR][COLOR=#333333]For lngArr = LBound(varNames2) To UBound(varNames2)[/COLOR]
[COLOR=#333333] Set wb = Workbooks.Open(ThisWorkbook.Path & "\" & varNames2(lngArr))[/COLOR]
[COLOR=#333333] Application.Run "'GRAND EVALUATIONS.xlsm'!Macro1"[/COLOR]
[COLOR=#333333] wb.Close True[/COLOR]
[COLOR=#333333] Set wb = Nothing[/COLOR]
[COLOR=#333333]Next lngArr
[/COLOR]
but it doesn't even open the file varNames2 = Array("FIRST - Copy\GRAND EVALUATIONS.xlsm").
Please provide me with some solutions to solve this problem.
Thank you

Last edited: