How is Access changing my Excel file?

ExcelMacLean

New Member
Joined
Dec 1, 2015
Messages
11
I create low-level automation solutions with Excel, these are usually small tools that accept user inputs, preform data calculations/manipulations, and generate outputs. I recently ran into a file-compatibility issue and need help. I am one small cog in a very large company and have no control over downstream tools. The output from my tool is zipped and fed into yet another tool downstream. It is this second tool that is rejecting my generated .xlsx file, and I do not know why.

Whats unusual is, some clever person fed my output into Microsoft Access as a Table, and then exported the same data again into Excel, and the new Access-Generated Excel file worked in the downstream automation. There was no other data-manipulation with access, and when compared visually the data in the two files is identical.

What is Access doing to generate a "cleaner" excel file? In my Excel VBA tool, the output data is stored as a variant array and then written directly to a new worksheet. I create a new workbook with Workbooks.add, the Variant Array is written directly to a Range (Range = VariantArray), then saved with Workbooks.SaveAs. In our test-files, the my final output file is 100kb. When the same data is imported into Access and then exported back to Excel, the file is 50kb, and works downstream.

To troubleshoot, I've tried executing Worksheet.ClearFormats on the new output worksheet before saving, and I've ensured the variant array contains no blank rows/Columns. My SaveAs function uses FileFormat:=xlOpenXMLWorkbook to generate the required .xlsx files. I do execute Range.NumberFormat = "@" on a range matching the VariantArray size before writing data because we deal with a lot of leading-zeros we cannot lose, so need the Text format, but after writing the data Range.NumberFormat = "General" to keep the files the same. I have a feeling this is why the files are different sizes, if Access is changing the datatypes? Any insight would be greatly appreciated.
 
Last edited:

Excel Facts

Can you AutoAverage in Excel?
There is a drop-down next to the AutoSum symbol. Open the drop-down to choose AVERAGE, COUNT, MAX, or MIN
are they generating xls rather than xlsx for another compatibility ?
 
Upvote 0
No, all input files were .xlsx and then zipped. That said, now I'm curious if the downstream automation would actually accept a .xls file instead. I'll try it today and report back.
 
Upvote 0

Forum statistics

Threads
1,224,297
Messages
6,177,746
Members
452,797
Latest member
prophet4see

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top