Option Explicit
Option Base 1
Dim FldNames As Variant
Dim DptNames As Variant
Dim fpath As String
Dim fper As String
Dim i As Integer
Sub OpenChicago()
FldNames = Array("grocery", "liquor", _
"gm", "produce", "nutrition", "meat", _
"srvdeli", "bakery\isbakery")
DptNames = Array("groc", "liquor", _
"gm", "produce", "nutrition", "meat", _
"srvdeli", "isbakery")
fpath = ThisWorkbook.Worksheets("A").Range("pathmw").Value
fper = ThisWorkbook.Worksheets("A").Range("C6").Value
For i = 1 To 8
Workbooks.Open Filename:=fpath '& FldNames(i) & "\" & DptNames(i) & fper, UpdateLinks:=1, _
IGNOREREADONLYRECOMMENDED:=True
Next i
MsgBox ("All margin files are now opened.")
End Sub
This code works fine in 2003 but in 2007 it stops at the Workbooks.open line with a cannot find path error. Any ideas.
Thank you
Option Base 1
Dim FldNames As Variant
Dim DptNames As Variant
Dim fpath As String
Dim fper As String
Dim i As Integer
Sub OpenChicago()
FldNames = Array("grocery", "liquor", _
"gm", "produce", "nutrition", "meat", _
"srvdeli", "bakery\isbakery")
DptNames = Array("groc", "liquor", _
"gm", "produce", "nutrition", "meat", _
"srvdeli", "isbakery")
fpath = ThisWorkbook.Worksheets("A").Range("pathmw").Value
fper = ThisWorkbook.Worksheets("A").Range("C6").Value
For i = 1 To 8
Workbooks.Open Filename:=fpath '& FldNames(i) & "\" & DptNames(i) & fper, UpdateLinks:=1, _
IGNOREREADONLYRECOMMENDED:=True
Next i
MsgBox ("All margin files are now opened.")
End Sub
This code works fine in 2003 but in 2007 it stops at the Workbooks.open line with a cannot find path error. Any ideas.
Thank you