ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   How to retain the size of excel file after using saveas (https://www.excelbanter.com/excel-programming/373705-how-retain-size-excel-file-after-using-saveas.html)

SpiderSwamy

How to retain the size of excel file after using saveas
 
Hi All,

I am facing some size related problem with excel
workbook....

I have a workbook at specific location. I am opening
that file and using saveas option to save it in a different folder. but
the size of the files almost doubles its size when copied to a
different location..

code:
strTempPath = App.Path & "\" & "scip.xls" ' to open where the
application is located.
Set xlAppS = New Excel.Application
Set wbS = xlAppS.Workbooks.Open(strTempPath) ' 'C:\swamy\scip.xls
strName = intGatorNo & "_Report" & ".xls"
strOutFile = strOutFol & "\" & strName 'C:\swamy\1122_Report.xls
On Error GoTo soln
xlAppS.ActiveWorkbook.SaveAs (strOutFile)
soln:
xlAppS.ActiveWorkbook.Close

Thanks in advance
Swamy


Tom Ogilvy

How to retain the size of excel file after using saveas
 
If all you are doing is opening and doing a saveAs, I would not see any
reason for the file size to change unless you have your default file format
set for the format combination of xl97-2003 & xl95.

try it this way

xlAppS.ActiveWorkbook.SaveAs strOutFile, xlWorkbookNormal

--
Regards,
Tom Ogilvy




"SpiderSwamy" wrote:

Hi All,

I am facing some size related problem with excel
workbook....

I have a workbook at specific location. I am opening
that file and using saveas option to save it in a different folder. but
the size of the files almost doubles its size when copied to a
different location..

code:
strTempPath = App.Path & "\" & "scip.xls" ' to open where the
application is located.
Set xlAppS = New Excel.Application
Set wbS = xlAppS.Workbooks.Open(strTempPath) ' 'C:\swamy\scip.xls
strName = intGatorNo & "_Report" & ".xls"
strOutFile = strOutFol & "\" & strName 'C:\swamy\1122_Report.xls
On Error GoTo soln
xlAppS.ActiveWorkbook.SaveAs (strOutFile)
soln:
xlAppS.ActiveWorkbook.Close

Thanks in advance
Swamy




All times are GMT +1. The time now is 02:50 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com