Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 50
Default File size gets huge on photo insert

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?

Thanks!
  #2   Report Post  
Posted to microsoft.public.excel.programming
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
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 50
Default File size gets huge on photo insert

I've compressed the image down to 23 KB, and file size still jumps from 233
KB to 4 MB on insert.

"joel" wrote:

You need to compress the quality of the picture. I usually do this by e-mail
the picture to myself using the following technique

go to the picture using window explorer and select all the pictures. then
right click on selected items and choose Send To - Mail Recipient. then when
the option to make smaller comes up I select make smaller. Once the picture
is loaded into email you can then save attachments. The insert the smaller
image into the picture box.

"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?

Thanks!

  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 50
Default File size gets huge on photo insert

That's interesting. I'm using form controls. I wonder if the problem is
specific to OLE form controls or if the same issue would occur with an
ActiveX control. I guess I'll experiment.

I'm new to VBA, and although I had a class on VB 6, that was a long time
ago...

"Martin Brown" wrote:

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

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 230
Default File size gets huge on photo insert

mooresk257 wrote:
That's interesting. I'm using form controls. I wonder if the problem is
specific to OLE form controls or if the same issue would occur with an
ActiveX control. I guess I'll experiment.

I'm new to VBA, and although I had a class on VB 6, that was a long time
ago...


Try doing it by hand and you will find that certain sequences cause this
huge size effect whereas others do not. In VBA it is much harder to
avoid having this problem - most permutations generate oversized files.


Regards,
Martin Brown
Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
File size gets huge on photo insert joel Excel Programming 0 May 5th 09 08:01 PM
Help- Insert text if photo file not available Stevep4 Excel Discussion (Misc queries) 6 January 23rd 09 04:34 PM
Huge increase in file size Gray Excel Discussion (Misc queries) 1 May 25th 06 08:54 AM
File size is huge Lewis Excel Programming 3 November 18th 05 04:21 PM
Huge File size after import trickdos[_18_] Excel Programming 0 October 15th 04 12:20 AM


All times are GMT +1. The time now is 06:52 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"