Results 1 to 3 of 3
  1. #1
    redbull's Avatar
    redbull is offline Competent Performer
    Windows XP Access 2010 32bit
    Join Date
    Mar 2012
    Location
    Missouri
    Posts
    480

    Saving an excel file, increases the file size from 250kb to 66mb?

    I have a process that is opening an existing excel sheet, changing the columns, fonts, colors etc. Then runs some automation against another system and puts more data in the sheet and then saves it. BUT for some reason the file size is jumping from 250kb to almost 67mb. How can I fix this? Below is all the code associated with excel.




    Code:
    Sub Fat_Cows_Come_Home_Slowly()
    ' Set excel information
    Set wb = xlApp.Workbooks.Open("Opens the 250kb excel sheet. With 500 rows, 3 columns wide. ")
    xlApp.Application.Visible = True
    Set ws = wb.Sheets("Sheetname")
    
    With ws
      .Range("A1:Z999999").NumberFormat = "@"
      .Range("A1:F1").Interior.Color = RGB(250, 204, 77)
      .Range("A1:K1").Font.Bold = True
      .Range("A1:Z99999").HorizontalAlignment = xlCenter
      .Range("A1:Z99999").VerticalAlignment = xlCenter
      .Range("A1:Z99999").RowHeight = 12.75
      .Range("A1:Z99999").Font.Name = "Aparajita"
      .Range("A1:Z99999").Font.Size = 12
      .Cells(1, 4) = " Status "
      .Cells(1, 5) = " Data Entered "
      .Cells(1, 6) = " Complete? "
      .Columns("E").ColumnWidth = 50
      .Columns("F").ColumnWidth = 40
      .Columns("A").ColumnWidth = 11.5
      .Columns("B").ColumnWidth = 13.25
      .Columns("C").ColumnWidth = 18.25
      .Columns("D").ColumnWidth = 40
      .Rows("2:2").Select
    End With
    
    if something then
    ws.Cells(RowNum, 4) = "Reactivated - " & Variable 
    ws.Cells(RowNum, 6) = "No Changes Made"
    ws.Cells(RowNum, 5) = "N/A"
    end if
    
    wb.SaveAs FileName:="New file, same 500 rows. Now upto 6 column wide. but now almost 67MB in size"

    So am I doing something really dumb and paying the price in file size?

  2. #2
    ranman256's Avatar
    ranman256 is offline VIP
    Windows Vista Access 2010 32bit
    Join Date
    Apr 2014
    Location
    Kentucky
    Posts
    9,525
    you are formatting A1:Z9999.
    even tho you don't see nuthin, the formatting is in there.

  3. #3
    redbull's Avatar
    redbull is offline Competent Performer
    Windows XP Access 2010 32bit
    Join Date
    Mar 2012
    Location
    Missouri
    Posts
    480
    Back to the TinkerShop.

Please reply to this thread with any new information or opinions.

Similar Threads

  1. Replies: 14
    Last Post: 05-24-2017, 02:22 PM
  2. Replies: 21
    Last Post: 01-24-2012, 06:21 PM
  3. Replies: 5
    Last Post: 06-12-2011, 07:54 PM
  4. File size smaller after saving
    By Pilotwings_64 in forum Access
    Replies: 1
    Last Post: 08-20-2010, 06:21 AM
  5. Access 2007 file size vs Excel
    By andrewalms in forum Access
    Replies: 4
    Last Post: 02-02-2010, 02:32 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
Other Forums: Microsoft Office Forums