vba opening file

Forum home » Delegate support and help forum » Microsoft Excel VBA Training and help » VBA opening a file

VBA opening a file

resolvedResolved · Low Priority · Version 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:

Using Excel's MODE function

Use Excel's MODE function to display the most common value present in a particular range of cells.

The Mode function looks like this:

=MODE(cell range)

As an example, if 35 is the most commonly recurring number in a particular cell range, then the function will display 35.

View all Excel hints and tips


Server loaded in 0.08 secs.