You don't *have* to declare (Dim) your variables in VB(A).
The interpreter will figure out what kind of variable or object it is from
context if necessary, or even convert from one variable type to another
implicitly if necessary.
*BUT*... it's good practice to use DIM anyway. For one, you'll get error
messages immediately if you mistype, or use a variable/object incorrectly.
For another, IntelliSense can tell you which methods or properties are
applicable, so you can save a lot of typing (AutoComplete), and don't need
Help as much.
If you put an "Option Explicit" at the top of your code module, or if you
check the corresponding option in "Tools Options > Editor", the VBA editor
will remind you automatically if you forget.
I've checked everything on that dialog tab by the way... Not sure what the
default is, but I can use all the help I can get :-)
Klaus
"GB"
>
> "Klaus Linke"
> news:eqsONH%23cIHA.1168@TK2MSFTNGP02.phx.gbl...
>> Use "For Each", and it doesn't matter how many there are :-)
>
> Ah thanks. They hadn't invented 'For Each' when I learnt my programming,
> which was really a long, long time ago.
>
> I take it that you need to tell VBA what myProp is, so you include
> Dim myProp As DocumentProperty
>
> Does VBA infer the object type that you mean if there is only one type of
> object in a particular collection? I guess that would be kind of risky
> programming.
>
> Then you can just use it naturally, as in
> For Each myProp In ActiveDocument.BuiltInDocumentProperties or
> myProp.Name
>
> Nice!
>
>
>