Simple Excel 2007 VBA Enum question

Posted on 2010-01-05
Last Modified: 2012-05-08
The following causes an error in Excel 2003 but works in 2007:

wbk.SaveAs Filename:=sFile, FileFormat:=xlExcel8, CreateBackup:=False

What file format constant do I need to use to have this work in both 2003 and 2007?
Question by:Wicklunda
    LVL 59

    Accepted Solution

    Use this...

    wbk.SaveAs sFile, xlWorkbookNormal

    Open in new window

    LVL 5

    Assisted Solution

    excel 2003 does not understands the xlExcel8 format so you need the following

    if application.Version > 11 then
        wbk.SaveAs Filename:=sFile, FileFormat:=xlExcel8, CreateBackup:=False
        wbk.SaveAs Filename:=sFile, FileFormat:=xlWorkbookNormal, CreateBackup:=False
    End if

    Open in new window


    Featured Post

    What Is Threat Intelligence?

    Threat intelligence is often discussed, but rarely understood. Starting with a precise definition, along with clear business goals, is essential.

    Join & Write a Comment

    A2 = A1 That kind of cell reference is relative.  If you copy it from A2 to B2, then B2 will get this: B2 = B1 That's all fine and good, but if you then insert a new row above row 2, you'll find: A3 = A1 B3 = B1 This is intentional. …
    Sparklines have been introduced with Excel 2010 and are a useful tool for creating small in-cell charts, used for example in dashboards. Excel 2010 offers three different types of Sparklines: Line, Column and Win/Loss. What it does not offer is a…
    The viewer will learn how to create two correlated normally distributed random variables in Excel, use a normal distribution to simulate the return on different levels of investment in each of the two funds over a period of ten years, and, create a …
    This Micro Tutorial demonstrate the bugs in Microsoft Excel for Mac with Pivot Charts.

    746 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    14 Experts available now in Live!

    Get 1:1 Help Now