View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Martin Brown Martin Brown is offline
external usenet poster
 
Posts: 230
Default File size gets huge on photo insert

mooresk257 wrote:
I have a picture box with the following code:

Private Sub Image1_Click()

FileToOpen = Application.GetOpenFilename( _
"All Files (*.jpg),*.jpg,(*.bmp),*.bmp")
If FileToOpen < False Then
Worksheets("Sheet1").OLEObjects("Image1").Object.P icture _
= LoadPicture(FileToOpen)
End If

End Sub

The file contains four sheets, and has a file size of 224 KB. When I insert
a photo with a file size of 129 KB into the photobox and save the Excel file,
the Excel file size balloons to 4.00 MB. If I insert a second photo, it goes
up over 9 MB.

Anybody know what is causing this, and how can I fix it?


I have seen this before in some versions of Word and Excel. The problem
seems to arise only when you load an image in a particular way onto a
preexisting image location. It generates persistent orphanned OLE
metafile resources which are huge. The worst one I ever saw was over
60MB in size and contained just 4MB of valid image data. Documents that
have been editted repeatedly with more than one version of Office seem
to be the most often afflicted.

There is a misleading MSKB entry that describes the problem. I can't
find the right one at the moment, but the one describing a related
PowerPoint to Word conversion OLE overhead is closely related to your
problem.

http://support.microsoft.com/kb/912676/en-us

Regards,
Martin Brown