O
Otto Moehrbach
Excel XP & Win XP
I'm helping an OP. He has Excel 2003 Pro.
He and I have now run the code shown below several times on both our
computers. His computer fails on the "Set wb = Workbooks.Open.........."
line every time.
Note that the code is looking for a .csv file. The Temp folder has a bunch
of those. It also has one .xls file. We both changed the ".csv" to ".xls"
in the below code and ran the code again.
In ALL cases, the file opens on my computer and NEVER opens on his.
The error is always on the "Set wb..." line.
My question: Why does this code fail on his computer and not on mine?
Thanks for your time. Otto
Sub testopen()
ThePath = "C:\Temp\"
ChDir ThePath
TheFile = Dir("*.csv")
Application.DisplayAlerts = False
Set wb = Workbooks.Open(ThePath & TheFile)
Application.DisplayAlerts = True
End Sub
PS: I sent him the entire file, so it's not a case of copy/paste.
I'm helping an OP. He has Excel 2003 Pro.
He and I have now run the code shown below several times on both our
computers. His computer fails on the "Set wb = Workbooks.Open.........."
line every time.
Note that the code is looking for a .csv file. The Temp folder has a bunch
of those. It also has one .xls file. We both changed the ".csv" to ".xls"
in the below code and ran the code again.
In ALL cases, the file opens on my computer and NEVER opens on his.
The error is always on the "Set wb..." line.
My question: Why does this code fail on his computer and not on mine?
Thanks for your time. Otto
Sub testopen()
ThePath = "C:\Temp\"
ChDir ThePath
TheFile = Dir("*.csv")
Application.DisplayAlerts = False
Set wb = Workbooks.Open(ThePath & TheFile)
Application.DisplayAlerts = True
End Sub
PS: I sent him the entire file, so it's not a case of copy/paste.