ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   CallByName in Excel for Fill object (https://www.excelbanter.com/excel-programming/375952-callbyname-excel-fill-object.html)

bv0001

CallByName in Excel for Fill object
 
Thank you very much for your time and help.

I am trying to access the Fill object in Excel, by its name.

The object is instancenable, becuse the the following command works.

Set o1 = Excel.ActiveWorkbook.Sheets(1).Shapes(1).Fill

How the command below returns the error 438 - object does not support this
property or method.

Set o2 = Excel.ActiveWorkbook.Sheets(1).Shapes(1)
Set o3 = CallByName(o2, "Fill", VbGet, Empty)

Can you please help me resolve this problem or find a work around?

Thank you very much for your help.

Peter T

CallByName in Excel for Fill object
 
This worked for me -

Set o2 = Excel.ActiveWorkbook.Sheets(1).Shapes(1)
Set o3 = CallByName(o2, "Fill", VbGet)

MsgBox TypeName(o3) ' FillFormat

as did -

Set o3 = o2.Fill

Regards,
Peter T

"bv0001" wrote in message
...
Thank you very much for your time and help.

I am trying to access the Fill object in Excel, by its name.

The object is instancenable, becuse the the following command works.

Set o1 = Excel.ActiveWorkbook.Sheets(1).Shapes(1).Fill

How the command below returns the error 438 - object does not support this
property or method.

Set o2 = Excel.ActiveWorkbook.Sheets(1).Shapes(1)
Set o3 = CallByName(o2, "Fill", VbGet, Empty)

Can you please help me resolve this problem or find a work around?

Thank you very much for your help.




bv0001

CallByName in Excel for Fill object
 
Dear Peter thank you very, very much!

"Peter T" wrote:

This worked for me -

Set o2 = Excel.ActiveWorkbook.Sheets(1).Shapes(1)
Set o3 = CallByName(o2, "Fill", VbGet)

MsgBox TypeName(o3) ' FillFormat

as did -

Set o3 = o2.Fill

Regards,
Peter T

"bv0001" wrote in message
...
Thank you very much for your time and help.

I am trying to access the Fill object in Excel, by its name.

The object is instancenable, becuse the the following command works.

Set o1 = Excel.ActiveWorkbook.Sheets(1).Shapes(1).Fill

How the command below returns the error 438 - object does not support this
property or method.

Set o2 = Excel.ActiveWorkbook.Sheets(1).Shapes(1)
Set o3 = CallByName(o2, "Fill", VbGet, Empty)

Can you please help me resolve this problem or find a work around?

Thank you very much for your help.






All times are GMT +1. The time now is 08:57 AM.

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