Solved

Excel Native Format with VBA

Posted on 2013-01-22
2
234 Views
Last Modified: 2013-01-23
I have to create a file upload from Access VBA which will export in XLS 2003. When I do CreateObject("Excel.Application"), etc, etc i get an OK looking file and the properties of the file say version 97-2003, but if you open the file in Excel, you get the 'Unrecognized format...' even though it will open.
This may break the upload, is there anyway round this or is it build into the system so you have to buy a license for making Excel files.
Maybe OLE-Automation,after file creation?
0
Comment
Question by:Silas2
  • 2
2 Comments
 
LVL 92

Expert Comment

by:Patrick Matthews
ID: 38807906
It would be helpful to see the code you are using...
0
 
LVL 92

Accepted Solution

by:
Patrick Matthews earned 250 total points
ID: 38807927
In any event, assuming you are running Access 2007/2010...



Dim xlApp As Object, xlWb As Object

Set xlApp = CreateObject("Excel.Application")
Set xlWb = xlApp.Workbooks.Add

' do some stuff

xlWb.SaveAs "c:\folder\subfolder\file.xls", 56
xlWb.Close False
Set xlWb = Nothing
xlApp.Quit
Set xlApp = Nothing

Open in new window


The '56' is needed to tell Excel to use the old XLS file format.  Without it, Excel will use the new OpenXML format despite the .xls extension.
0

Featured Post

Do You Know the 4 Main Threat Actor Types?

Do you know the main threat actor types? Most attackers fall into one of four categories, each with their own favored tactics, techniques, and procedures.

Join & Write a Comment

INDEX and MATCH can be used to great effect to replace HLOOKUP and VLOOKUP as it does not have the limitation of needing the data to be sorted so that the reference value is in the first column or row. It also has the ability to perform a bi-directi…
Introduction While answering a recent question (http:/Q_27311462.html), I created an alternative function to the Excel Concatenate() function that you might find useful.  I tested several solutions and share the results in this article as well as t…
This Micro Tutorial will demonstrate in Microsoft Excel how to add style and sexy appeal to horizontal bar charts.
This Micro Tutorial will demonstrate how to use a scrolling table in Microsoft Excel using the INDEX function.

706 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

13 Experts available now in Live!

Get 1:1 Help Now