Jow
05-21-2008, 03:24 AM
Here's the code I'm using...It basically opens up each excel file inside a folder one at a time, and runs code within each file.
Dim wb As Workbook
Dim TheFile As String
Dim MyPath As String
MyPath = "\\Server-1\production_share\Production (file://\\Server-1\production_share\Production) Bucket Folder\"
ChDir MyPath
TheFile = Dir("*.csv")
Do While TheFile <> ""
Set wb = Workbooks.Open(MyPath & "\" & TheFile)
*CODE HERE*
wb.Close SaveChanges:=True
TheFile = Dir
Loop
The problem is that it doesn't work when I'm using a network path (as above), it will only work when the path I'm using is on a local drive.
For example, when I change 'Mypath' to -
"C:\Users\ianlane\Desktop\TESTING BUCKET FOLDER"
it works fine.
I have tried using a mapped network drive, but this doesn't work either, it still won't work.
Later on in my code I use the same network path to copy the contents of one folder to another, and it works perfectly for this purpose, but not with workbooks.open -
Is this a known issue? Any ideas on how I can get around it?
Dim wb As Workbook
Dim TheFile As String
Dim MyPath As String
MyPath = "\\Server-1\production_share\Production (file://\\Server-1\production_share\Production) Bucket Folder\"
ChDir MyPath
TheFile = Dir("*.csv")
Do While TheFile <> ""
Set wb = Workbooks.Open(MyPath & "\" & TheFile)
*CODE HERE*
wb.Close SaveChanges:=True
TheFile = Dir
Loop
The problem is that it doesn't work when I'm using a network path (as above), it will only work when the path I'm using is on a local drive.
For example, when I change 'Mypath' to -
"C:\Users\ianlane\Desktop\TESTING BUCKET FOLDER"
it works fine.
I have tried using a mapped network drive, but this doesn't work either, it still won't work.
Later on in my code I use the same network path to copy the contents of one folder to another, and it works perfectly for this purpose, but not with workbooks.open -
Is this a known issue? Any ideas on how I can get around it?