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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

OLE XLS in a form, can't get it to work.

Status
Not open for further replies.

1DMF

Programmer
Jan 18, 2005
8,795
GB
Hi,

Why do I seem unable to load an XLS file in an OLE unbound object frame?

I have an object frame (linked) called xls

I am using this code...

Code:
With Me.xls
                .Enabled = True
                .Locked = False
                .Class = "Excel.Sheet"
                .SourceDoc = sDoc
                .OLETypeAllowed = acOLELinked
                .Action = acOLECreateLink
                .SizeMode = acOLESizeZoom
                .Visible = True
            End With

But it just errors with
Can't perform the operation specified in the Action property

Why can't I view a an XLS file?

1DMF

"In complete darkness we are all the same, it is only our knowledge and wisdom that separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"
Free Electronic Dance Music
 
This is weird I deleted the control and added it again, and this time this works?

Code:
        Case Is = "xls", "xlsx"
            With Me.xls
                .Enabled = True
                .Locked = False
                .SourceDoc = sDoc
                .Visible = True
                .Action = acOLECreateEmbed
                .SizeMode = acOLESizeZoom
            End With

It's because the control was not 'visible' when I tried to perform the action, if I make it visible, then perform the action it works. man that was doing my head in!

"In complete darkness we are all the same, it is only our knowledge and wisdom that separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"
Free Electronic Dance Music
 
I was messing with linked vs embeded, I was getting the error on both , it was because the control wasn't visible.

I so far got a half working GUI now.

I have had to put a webcontrol, OLE frame and a picture object and then flick between the objects depending on the document type.

One issue I have is if I use

.Action = acOLEActivate

The document is opening in the application first time round, but if I use the doubleclick on the OLE object, it opens it in the object?

So why is issuing the activate command opening the document in the office application and not the OLE control?


"In complete darkness we are all the same, it is only our knowledge and wisdom that separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"
Free Electronic Dance Music
 
I resolved the above but putting an onload event and a timer event.

It seems the object needs to have been rendered and the form visible otherwise it will open the doc in the office application instead of the OLE control

"In complete darkness we are all the same, it is only our knowledge and wisdom that separates us, don't let your eyes deceive you."

"If a shortcut was meant to be easy, it wouldn't be a shortcut, it would be the way!"
Free Electronic Dance Music
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top