hi there how could i display an excel worksheet inside ms access in vb6 like a window into window. thx
Printable View
hi there how could i display an excel worksheet inside ms access in vb6 like a window into window. thx
Can you explain a little more of what your trying to do?
I'm trying to open an excel sheet inside ms access window via a vb code. I can open by 'Set xlApp = CreateObject("Excel.Application")' but it will be outside my MS Access window, it want it to be part of the ms access window tabs.
Ok, thats not really possible in the sense of stability.
What you could do is place a DB DataGrid on an Access Form. Then populate it with your Excel data.
Or, use OLE on an Access Form to embed your Excel workbook but it will still open as an external window.
What is OLE...Could you please give me an example on an OLE. thank you
I believe you can do it with Access' Bound Object Frame control from the toolbox. OLE stands for Object Linking and Embedding. Drop a BOF on to your form and set the properties and check the helpfile for specific issues. :)
Thank you very much for your help
No prob. :) I havent done it this way but it appears to be the same as if you were to do it using the OLE Control in VB6.
yeah but how to display the excel sheet in the BOF code-wise
Did you fill in the Source Doc property?
I got this example from the help file in Access.
VB Code:
Sub Command1_Click OLE1.Class = "Excel.Sheet" ' Set class name. ' Specify type of object. OLE1.OLETypeAllowed = acOLELinked ' Specify source file. OLE1.SourceDoc = "C:\Excel\Oletext.xls" ' Specify data to create link to. OLE1.SourceItem = "R1C1:R5C5" ' Create linked object. OLE1.Action = acOLECreateLink ' Adjust control size. OLE1.SizeMode = acOLESizeZoom End Sub
How should i declare the variable OLE1 there are serveral options.
Its the control not a variable.
I'm getting this error
'Compile Error Variable not defined'. its highlighting the OLE1
OLE1 should be the name of your BOF control. Also, your not trying to display Excel on your VB6 Form?
i will also be displaying drawings, images and so on
If you drawings and images are in the same excel workbook then its no extra work.
no they are not in the same excel worksheet they all seperate. For the moment i'm only working on how to display a drawing or an image in the OLE area. I had a look in the access help but i could find any programming OLE help. Could you please guide me. thank you.
So to clear things up, we are done with the excel workbook issue?
yeah. do you want me to post a new thread about how to display the drawing or image
No, its ok. We can continue in this one.
To display an image you would use a Image control and set the Picture property.
What kind of chart are you using?
I had a look and i think we need to use Display bound images (images that change with each database record or report page). Its from smartsketch and the extention is .dwg (for example test.dwg). I have created a Bound Object Frame: OLE1 on my form and added to the database as a OLEObject. So
when the i press an button it should display the diagram itself (not
the link) inside the Bound Object Frame and be able to zoom in and out and edit.