ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Discussion (Misc queries) (https://www.excelbanter.com/excel-discussion-misc-queries/)
-   -   Querying Properties programmatically (https://www.excelbanter.com/excel-discussion-misc-queries/94704-querying-properties-programmatically.html)

BizMark

Querying Properties programmatically
 
Hi there,

I have a question which has been bugging me for some time.

Is there any way to access Properties for any given object programmatically? For example, say I want to store (as I do) all properties for a given cell into a text file so that I can read them back, can you do it?

I wanted to do something like:

Open "properties.txt" for Output as 1
For Each xProp in ActiveCell.Properties
Write #1, xProp.Name; "="; xProp.Value
Next xProp
Write #1, ActiveCell.Properties.Count; " properties found."
Close 1

Which would give something like:

.Value = 0.532657
.Text = 0.533
.NumberFormat = "0.000"
.Width = 18
.Font.Name = "Tahoma"
|
|
170 properties found.

...and so on. I think you get the idea.

I realise the above doesn't work, but what I'm interested to know is if there is an Object that I can use which then exposes the Properties of an Object that follows - perhaps VBE. (something) ... .ActiveCell.Properties that will then enable something like the above to achieve what I desire?

Would much appreciate it if anyone has the answer to this.

Regards,
BizMark


All times are GMT +1. The time now is 01:28 AM.

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