I'm using the following code to create a macro that looks into various directories and files based on a specified list. The macro was working correctly yesterday, but now I keep getting an error message that says it cannot find the appropriate file (even though the file names are correct). Any ideas what I could do to fix?
Sub CreateGroupProcurementsFile()
' '
Application.ScreenUpdating = False
'create variable for user path and file
Dim MyPath
Dim MyFile
'Clear Old Data
GroupProcurement.Range("A7:T10000").Select
Selection.ClearContents
'start at first file
MACRO.Select
Range("A7").Select
'create loop for each file
Do Until ActiveCell = ""
Let MyPath = ActiveCell.Value
ActiveCell.Offset(0, 1).Range("A1").Select
Let MyFile = ActiveCell.Value
ChDir MyPath
Set wbOpen = Workbooks.Open(Filename:=MyFile, UpdateLinks:=0) 'This is the line that is continually getting caught up
'Copy and Paste Range file
Sheets("Plan").Select
Range("A51:T1200").Copy
Windows("GroupProcurements.xls").Activate
GroupProcurement.Select
Range("A65536").End(xlUp).Select
ActiveCell.Offset(1, 0).Select
Selection.PasteSpecial Paste:=xlPasteValues
wbOpen.Close
'move down to next file
MACRO.Select
ActiveCell.Offset(0, -1).Range("A1").Select
ActiveCell.Offset(1, 0).Range("A1").Select
Loop
'end of loop above
GroupProcurement.Select
Range("A1").Select
End Sub
Sub CreateGroupProcurementsFile()
' '
Application.ScreenUpdating = False
'create variable for user path and file
Dim MyPath
Dim MyFile
'Clear Old Data
GroupProcurement.Range("A7:T10000").Select
Selection.ClearContents
'start at first file
MACRO.Select
Range("A7").Select
'create loop for each file
Do Until ActiveCell = ""
Let MyPath = ActiveCell.Value
ActiveCell.Offset(0, 1).Range("A1").Select
Let MyFile = ActiveCell.Value
ChDir MyPath
Set wbOpen = Workbooks.Open(Filename:=MyFile, UpdateLinks:=0) 'This is the line that is continually getting caught up
'Copy and Paste Range file
Sheets("Plan").Select
Range("A51:T1200").Copy
Windows("GroupProcurements.xls").Activate
GroupProcurement.Select
Range("A65536").End(xlUp).Select
ActiveCell.Offset(1, 0).Select
Selection.PasteSpecial Paste:=xlPasteValues
wbOpen.Close
'move down to next file
MACRO.Select
ActiveCell.Offset(0, -1).Range("A1").Select
ActiveCell.Offset(1, 0).Range("A1").Select
Loop
'end of loop above
GroupProcurement.Select
Range("A1").Select
End Sub