Liyan has attended:
Excel VBA Intro Intermediate course
Access Intermediate course
Access Advanced course
Excel VBA Advanced course
Access VBA course
VBA opening a file
Hi,
I am trying to open an Excel file which may be saved in the 2003 version or 2007 version.
What is the best way to open the file regardless of the version?
Many thanks.
Liyan
RE: VBA opening a file
Hello Liyan,
You don't need to specify the extension so the following would open a workbook whatever version.
Workbooks.Open "C:\" & "Book1"
I hope this resolves your question. If it has, please mark this question as resolved.
If you require further assistance, please reply to this post. Or perhaps you have another Microsoft Office question?
Have a great day.
Regards,
Mark
Microsoft Office Specialist Trainer
RE: VBA opening a file
Hello Mark,
Sorry. I can't get it working.
The code I recorded initially was (which workded fine, except I had to change xlsx to xls and xls to xlsx all the time):
Workbooks.Open Filename:= _
"L:\Irish Sea\P&O Pricing\Price Ladder Reports\Irish Sea Trinity Report 2010 (working).xlsx"
The code I used by following your post is:
Workbooks.Open "L:\Irish Sea\P&O Pricing\Price Ladder Reports\" & "Irish Sea Trinity Report 2010 (working)"
What have I done wrong?
Thanks a lot.
Liyan