Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel File Bloat when copying via VBA

Status
Not open for further replies.

idbr

MIS
May 1, 2003
247
GB
Hi,

I have a simple data copy operation (running via Access VBA):

appXL.ActiveWorkbook.Sheets(strSourceTab).UsedRange.Select
appXL.Selection.Copy
appXL.Workbooks(strWorkingFileName).Activate
appXL.Workbooks(strWorkingFileName).Worksheets(1).Activate
appXL.Workbooks(strWorkingFileName).Worksheets(1).Range("A1").Select
appXL.Selection.PasteSpecial Paste:=xlPasteValues

The used range in the source book is correctly selecting only the data. No formatting is applied to the data in the working book.

The resulting file when saved is more than twice as large as the source data, despite having exactly the same data! (5266KB vs 12356KB)

Any ideas what might be causing this?

Thanks, Iain
 


Hi,

Try this...
Code:
appXL.ActiveWorkbook.Sheets(strSourceTab).UsedRange.Copy
appXL.Workbooks(strWorkingFileName).Worksheets(1).Range("A1").PasteSpecial Paste:=xlPasteValues

Skip,
[sub]
[glasses]Just traded in my old subtlety...
for a NUANCE![tongue][/sub]
 
It can be due to coding workbook data. I have an access application that exports queries to excel workbook (DoCmd.TransferSpreadsheet). The output workbook reduces its size twice when it is opened and saved again.

combo
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top