Access 2K Reports – Auto re-size OLE in bound object frame

CarolW

Registered User.
Local time
Yesterday, 19:21
Joined
Mar 24, 2006
Messages
58
Good Evening,

Could some kind person out there in the world please tell me whether or not it is possible to automatically re-size a bound OLE object frame in a report, so that it grows or shrinks in size to accommodate pictures of varying sizes. I have managed to incorporate a similar feature in a form which does exactly what I need, including text box re-sizing, however I am at a loss as to how to get a similar result with a report. I have searched and searched for a solution but without any success. I am rapidly pulling my hair out with frustration……………..


Any help or assistance would be very much appreciated

Kind Regards

CarolW

Source kind courtesy of http://www.lebans.com/autosizeole.htm

Option Compare Database
Option Explicit


Private Sub Form_Current()
' Call our Autosize function if the
' control is not empty.
If Not IsNull(Me.OLEBoundAutosize.Value) Then
AutoSizeOLE Me.OLEBoundAutosize
End If
End Sub


Private Sub Form_Load()
DoCmd.MoveSize 0, 0, 8000, 8500
End Sub


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
DoEvents

' 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
Exit Sub

Err_handler:
MsgBox Err.Description, vbCritical, Err.Number

End Sub
 

Users who are viewing this thread

Back
Top Bottom