Public Schedule Face-to-Face & Online Instructor-Led Training - View dates & book

vba opening file

ResolvedVersion 2007

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

Thu 19 Jul 2012: Automatically marked as resolved.

 

Training courses

Training information:

Welcome. Please choose your application (eg. Excel) and then post your question.

Our Microsoft Qualified trainers will then respond within 24 hours (working days).

Frequently Asked Questions
What does 'Resolved' mean?

Any suggestions, questions or comments? Please post in the Improve the forum thread.

Excel tip:

Selecting blank cells within a range of data

Select the range of data which includes the blank cells that you would like to select. Press the F5 key, this will take you to the GoTo dialogue box where you can click on Special and then select Blanks.

View all Excel hints and tips

Connect with us:

0207 987 3777

Call for assistance

Request Callback

We will call you back

Server loaded in 0.12 secs.