define variable as Table vs Tables

M

mikenam

i just noticed vba allows you to define a variable as "Table" or
"Tables" is there a difference?

I usually declare

oTb as *Table*

for each oTb in activedocument.*Tables*

Next
 
S

Simon Lloyd

It can be read like this
For Each Object in the Collection of Objects, so if you DIM oTb a
Tables your code would read for each objects in objects, if you wer
working with measurement you wouldn't state for each Metre in Metre, yo
would state For Each Centimetre in Metre.......hope that helps a littl
:

mikenam;423411 said:
i just noticed vba allows you to define a variable as "Table" o
"Tables" is there a difference

I usually declar

oTb as *Table

for each oTb in activedocument.*Tables

Nex

--
Simon Lloy

Regards,
Simon Lloyd
'The Code Cage' (http://www.thecodecage.com
 
P

Peter Jamieson

You would use a variable of type Tables if you wanted to set a variable
to a Tables collection. e.g. you would /not/ do this

Dim oTb as Tables
for each oTb in activedocument.Tables

You might do this

Dim bActiveDocument
Dim oTb as Table
Dim oTbs as Tables
Set oTbs = Activedocument.Tables
for each oTb in oTbs

(e.g. perhaps you have code that needs to work with the Activedocument
in one case and another document in another situation, so you set oTbs
to the collection of Tables in the appropriate document first)


Peter Jamieson

http://tips.pjmsn.me.uk
 

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