Determining whether a workbook is a 2003 or 2007 workbook

S

sleepp

Hi,

Since users can resave a workbook in .xlsx format, is there a recommended
way of determining whether a workbook supports 2007's increased rows and
columns? I display a warning when the user tries to display something
greater than the max columns or rows and checking the Application.Version
only works when the user opens
a. Excel 2003 application and 2003 workbook
b. Excel 2003 application and 2007 workbook
c. Excel 2007 application and 2003 workbook

I would like to handle the case where the workbook imposes the smaller limit.
d. Excel 2007 application and 2003 workbook

Is there a better method than checking the file extension?

Thanks!
 
B

Bob Phillips

Check the Rows.Count property, if it is greater than 100,000 then it is
2007!
 
R

Rick Rothstein

Can't you just check any worksheets Row.Count and/or Columns.Count property
to test the maximum limits?

MsgBox Worksheets(1).Rows.Count, Worksheets(1).Columns.Count
 
S

sleepp

Genius! I never knew that worked.
Thanks!

Bob Phillips said:
Check the Rows.Count property, if it is greater than 100,000 then it is
2007!

--
__________________________________
HTH

Bob
 
H

Harald Staff

Hi friends

Our company has set xls as default file format in Excel2007 -this is to
avoid ignorant users sending xlsx files to users with older versions.
Skilled users can change default and do whatever.
Behavious of Excel is: Open a new file, it has 65k rows. SaveAs xlsx or
xlsm, it still has 65k rows, it goes into "compatibility mode". Here is
where rows.count will fail. Close the file and reopen, voila a million +
rows.

Best wishes Harald
 
J

Jurgen

you can check for workbook.fileformat (see the help on XlFileFormat for the
different versions) and check the application.version

regards,

Jurgen
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top