Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Bound OLE object

Status
Not open for further replies.

RDS2

Technical User
Jun 6, 2003
44
US
I have a OLE object frame on a form wich is used to create an embedded Excel worksheet. This is bound to a field in an underlying table.

Is there a way to code, say a command button, so that it will create (actually insert) the worksheet object without having to go to "Insert Object" on the command bar?
 
Don't know if it will help, but maybe you can look here:

thread705-1243827
 
I can get this far with the follwing code (assigned to the double click event of a command button):

OLEBound25.Class = "Excel.Sheet"
OLEBound25.OLETypeAllowed = acOLEEither
OLEBound25.Action = acOLECreateEmbed


OLEBound25 is the control name. This will create the worksheet in the control. I have yet to figure out how then to open the worksheet for editing other than double-clicking (via the Auto-Activate property.)

There should be a way to code the button so that it also opens the worksheet. I've tried various items such as acOLEVerbShow to no avail.
 
How about:
[tt] [OLEBound25].SourceDoc = Me.txtFileName
[OLEBound25].Action = OLE_CREATE_EMBED
[OLEBound25].Action = acOLEActivate[/tt]
 
Thanks for the suggestions - all.

Sometime I just move in the wrong direction!
By adding Remou's last line:
OLEBound25.Action = acOLEActivate
to the existing code, everthing works as I want it - the worksheet is created and opened for editing.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top