Unanswered: Automatically fit OLE object size in a Report with embed image size?
Ok, my post title is not simple; so let me try to explain.
I have a table who has as fild that is a OLE object type.
This field has some images pasted as bitmaps.
The image size changes with every single record.
In the other side, I have a Report that shows the content of this table.
So, when it comes to the "image" I need to resize the OLE object (that has the source of this mentioned OLE object field) in order to see the hole picture.
I know that I can do a Shrink or Zoom to the picture... But I want to see the complete picture in the original size.
Any ideas how?
Any ideas how to know the real size of the bitmap pasted on the table field? So I will be able to change the size of the OLE object in the Report OnFormat?
Private Sub Detalle_Format(Cancel As Integer, FormatCount As Integer)
I'd like to use this module, but haven't used modules before. Could anyone help me out with how to implement this in my own existing DB? Where do the links occur between the form/report and the module?
I took a look at the example, and see that there are two parts to the module. I get the overall action that is happening, but I'm a bit confused when it comes to taking this code and applying it to an existing database with existing tables and forms. I'm not sure what the best way is to update my current DB to use this.
Just copy the module "modOLEtAutoSize" to your MDB file.
Also, add the next function to your code:
Private Sub AutoSizeOLE(ctl As Access.Control)
' Junk var
Dim lngRet As Long
' Vars to be filled in by
' GetOLEImageDimensions function
Dim IWidth As Long
Dim IHeight As Long
On Error GoTo Err_handler
' Call the OLE Action Verb to cause the
' control to copy its contents to the ClipBoard
Me.OLEBoundAutosize.Action = 4
' Call our function that will return a handle to
' the Metafile on the ClipBoard
lngRet = GetOLEImageDimensions(IWidth, IHeight)
Me.OLEBoundAutosize.width = IWidth
Me.OLEBoundAutosize.Height = IHeight
MsgBox Err.Description, vbCritical, Err.Number
Next use the function "AutoSizeOLE" to each object you want to auto-size.
And will auto-size the object according the content.
By the way: the content will be copied to the clipboard in order to analize the size.