OLE / Embedded Excel Worksheet

C

Craig Hornish

Hello,

How can I work with and embedded Excel Worksheet
that is in a field in a table.
I want to work with it the same way you can if it
was a file that was stored outside of Access -- ie

Dim objXLApp as Excel.Application
Dim objXLBook as Excel.WorkBook
Dim objXLSheet as Excel.WorkSheet
Dim objXLRange as Excel.Range

Set objXlBook = GetObject("C:\book1.xls")
....
Set objXLSheet = objXLBook.Worksheets("Sheet1")
Set objXLRange = objXLSheet.Range("A1:A1")

I have found no example of the correct steps to
assign the OLE field in a recordset, or a bound object
frame in a form to the objXLSheet.

Thanks for any help

Craig
 
J

John Nurick

Hi Craig,

I don't think you can get at the embedded worksheet from Excel. Instead,
start with a bound object frame on a form and set its Verb property to
(I think, I'm working from memory) acOLEVerbHide before activating it.
Then use something like this to get hold of first Excel and then the
workbook.

Set objXLApp = GetObject(,"Excel Application")
Set objXLBook = objXLApp.ActiveWorkbook
...

If there's a possibility of other instances of Excel or other workbooks
being open, you'll need to write check that you've got the right one.
 
C

Craig Hornish

Thanks,
The only thing I needed to change was the getObject
to "Excel.Application".

Craig

-----Original Message-----
Hi Craig,

I don't think you can get at the embedded worksheet from Excel. Instead,
start with a bound object frame on a form and set its Verb property to
(I think, I'm working from memory) acOLEVerbHide before activating it.
Then use something like this to get hold of first Excel and then the
workbook.

Set objXLApp = GetObject(,"Excel Application")
Set objXLBook = objXLApp.ActiveWorkbook
...

If there's a possibility of other instances of Excel or other workbooks
being open, you'll need to write check that you've got the right one.


Hello,

How can I work with and embedded Excel Worksheet
that is in a field in a table.
I want to work with it the same way you can if it
was a file that was stored outside of Access -- ie

Dim objXLApp as Excel.Application
Dim objXLBook as Excel.WorkBook
Dim objXLSheet as Excel.WorkSheet
Dim objXLRange as Excel.Range

Set objXlBook = GetObject("C:\book1.xls")
...
Set objXLSheet = objXLBook.Worksheets("Sheet1")
Set objXLRange = objXLSheet.Range("A1:A1")

I have found no example of the correct steps to
assign the OLE field in a recordset, or a bound object
frame in a form to the objXLSheet.

Thanks for any help

Craig

--
John Nurick [Microsoft Access MVP]

Please respond in the newgroup and not by email.
.
 

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