ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Using ActiveWorkBook.Container (https://www.excelbanter.com/excel-programming/376789-using-activeworkbook-container.html)

[email protected]

Using ActiveWorkBook.Container
 
Hi,
I am trying to write a macro in excel. I am trying to use the
container method.

Dim x As Object
Dim xx
xx = UCase(ActiveWorkbook.Name) 'This works
Worksheets("Sheet1").Activate
Set x = ActiveWorkbook.Container 'Get error at this line

The error is:
Run time error 1004. Application-defined or object-defined error

Does any one know why this would happen?

Regards,
AA


Norman Jones

Using ActiveWorkBook.Container
 
Hi Pukya,

Your objectives are unclear - please explain.

However, from VBA help on the Container method:

'-----------------------
Use this property with a contained workbook to return the container object.
If the container doesn't support OLE Automation or the workbook isn't
embedded, this property fails.
'-----------------------


---
Regards,
Norman


wrote in message
ups.com...
Hi,
I am trying to write a macro in excel. I am trying to use the
container method.

Dim x As Object
Dim xx
xx = UCase(ActiveWorkbook.Name) 'This works
Worksheets("Sheet1").Activate
Set x = ActiveWorkbook.Container 'Get error at this line

The error is:
Run time error 1004. Application-defined or object-defined error

Does any one know why this would happen?

Regards,
AA




Bob Phillips

Using ActiveWorkBook.Container
 
See response in excel.misc.

--
HTH

Bob Phillips

(replace somewhere in email address with gmail if mailing direct)

wrote in message
ups.com...
Hi,
I am trying to write a macro in excel. I am trying to use the
container method.

Dim x As Object
Dim xx
xx = UCase(ActiveWorkbook.Name) 'This works
Worksheets("Sheet1").Activate
Set x = ActiveWorkbook.Container 'Get error at this line

The error is:
Run time error 1004. Application-defined or object-defined error

Does any one know why this would happen?

Regards,
AA





All times are GMT +1. The time now is 03:41 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com