+ Reply to Thread
Results 1 to 9 of 9

Converting 2003 file 2007 on the fly

  1. #1
    Forum Expert
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    3,054

    Converting 2003 file 2007 on the fly

    Hi all, I've actually got a proper coding question, for a change.

    I'm using a data handling application which exports data to Excel, producing an Excel 2003 worksheet. Unfortunately this means that it gives an error if you try to export more than 256 columns of data (which I do every so often).

    I've found a way to make the other appliction split the columns over multiple Excel sheets and I have a macro which merges all of the individual sheets back onto the front sheet.

    However, before I can run my macro I need to:

    1. Save the exported workbook as an Excel 2007 xlsx file.
    2. Close the workbook
    3. Re-open the xlsx file.

    If I don't do this then my macro fails when the front sheet column count reaches 256.

    So, what I'm wondering is:

    1. Is there a programmatic way to tell Excel that it's no longer dealing with a 2003 format file and it can safely add columns above 256 or

    2. Is there a way to tell if the target workbook is a 2003 file which has just been saved as a 2007 file (in which case my macro can close and re-open it) or if it is a genuine 2007 xlsx file?

    Any advice greatly appreciated.

    Andrew
    Last edited by Andrew-R; 08-26-2010 at 09:09 AM.

  2. #2
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,434

    Re: Converting 2003 file 2007 on the fly

    Use can use the FileFormat property to determine type.

    Please Login or Register  to view this content.
    see XlFileFormat Enumeration for complete list of available types.

    Do you have control over the process that creates the initial workbook?
    Cheers
    Andy
    www.andypope.info

  3. #3
    Forum Guru romperstomper's Avatar
    Join Date
    11-04-2008
    Location
    A1
    MS-Off Ver
    Most
    Posts
    12,302

    Re: Converting 2003 file 2007 on the fly

    Check the workbook's Excel8CompatibilityMode property.
    Remember what the dormouse said
    Feed your head

  4. #4
    Forum Expert
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    3,054

    Re: Converting 2003 file 2007 on the fly

    Quote Originally Posted by Andy Pope View Post
    Do you have control over the process that creates the initial workbook?
    The process is:

    1. An MR specific application
    2. Based on JET database engine
    3. French

    What do you think?

  5. #5
    Forum Expert
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    3,054

    Re: Converting 2003 file 2007 on the fly

    Quote Originally Posted by romperstomper View Post
    Check the workbook's Excel8CompatibilityMode property.
    Perfect. Thanks Romperstomper.

  6. #6
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,434

    Re: Converting 2003 file 2007 on the fly

    Given the French software only kicks out xl2003 file format is the question sort of irrelevant.
    You always need to open the exported file and saveas to convert to xl2007 format.

  7. #7
    Forum Expert
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    3,054

    Re: Converting 2003 file 2007 on the fly

    Yes, I was just wondering if, having saved as 2007 format, there was a way to make Excel treat it as 2007, without closing and re-opening it.

  8. #8
    Forum Guru Andy Pope's Avatar
    Join Date
    05-10-2004
    Location
    Essex, UK
    MS-Off Ver
    O365
    Posts
    20,434

    Re: Converting 2003 file 2007 on the fly

    No, even if you do the conversion manully via the Convert button Excel will still need to close and open the file before the extra columns appear.

  9. #9
    Forum Expert
    Join Date
    07-16-2010
    Location
    Northumberland, UK
    MS-Off Ver
    Excel 2007 (home), Excel 2010 (work)
    Posts
    3,054

    Re: Converting 2003 file 2007 on the fly

    I feared as much, but the Excel8CompatabilityMode property is enough for me to automate the save/close/re-open process.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1