Activate an ole object by clicking a button (1 Viewer)

martlewis

Registered User.
Local time
Today, 13:32
Joined
May 3, 2011
Messages
20
Hi All,

I have a form with an OLE object that contains an embedded bitmap image. When I double click on the object the image opens in paint, which is exactly what I need it to do.

What I'd like to do is have a button on the form that, when clicked, copies a template bitmap image to the ole object (that bit already works) and then activates the object so paint opens up.

Anyone know how I can make the OLE object activate from a button on a form?

I hope that made sense?

Thanks.
 

martlewis

Registered User.
Local time
Today, 13:32
Joined
May 3, 2011
Messages
20
Maybe this should have been in the VBA code section since the solution I found uses code. Will post it anyway as I've read loads of requests on how to do this but not seen any answers...

On Click event procedure for the button that will activate the object...

With Forms.Item("formname").Controls.Item("oleobjectName")
.Action = acOLEActivate
.Verb = acOLEVerbOpen
End With

Hope this helps if anyone else needs it.
 

Joe8915

Registered User.
Local time
Today, 07:32
Joined
Sep 9, 2002
Messages
820
I received a error message. I know its me. My "formname" is "tblPayEstimates Subform" and its in a subform as well.
My objectname is located on a different drive C:/ob/.
So the bottom line how would I write the correct code.

Thanks
 

abubasil

Registered User.
Local time
Today, 16:32
Joined
Aug 31, 2011
Messages
29
Here is an answer after 9 years !


Code:
Private Sub btnopen_Click()

Me![oledoc].Verb = -2   ' Tells Microsoft Access to open the application.
Me![oledoc].Action = 7  ' Activates the application.

End Sub
 

Users who are viewing this thread

Top Bottom