Excel as OLE Object

P

Paul3rd

Hello,
This really is an Access question.
The following code embeds an Excel worksheet in my form.
Everything works fine until I protect the worksheet, then on the
Form Current event I get the following:
Runtime Error '-2147417848(80010108)'
"Method 'EnableSelection' of object _ 'Worksheet' failed.

Private Sub Form_Current()
'This code worked correctly until worksheet was protected.
Me.cboApptDate.SetFocus
Me.cboApptDate = Date
'Hide warning message
DoCmd.SetWarnings False
If IsNull(Me.OLEBound11) Then
'Specify Source File.
Me.OLEBound11.SourceDoc = Me.Text16
'Create embedded object.
Me.OLEBound11.Action = acOLECreateEmbed
'Unhide warning message
DoCmd.SetWarnings True
End If
End Sub
The worksheet is chosen by a combo box that displays a calendar control,
when the date is selected the correct worksheet is pulled into the OLE frame.
If anyone can help me with code to embed the protected worksheet I would be
very grateful.
Thanks in advance,
Paul
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top