Insert Table into Word Doc

baze7

New Member
I have been trying to insert a table into a word document. I have created a macro, but can't quiet figure out how to do it. Here is the macro:

ActiveDocument.Tables.Add Range:=Selection.Range, NumRows:=1, NumColumns:= _
1, DefaultTableBehavior:=wdWord9TableBehavior, AutoFitBehavior:= _
wdAutoFitFixed

Here is where I am at:

chword:Selection:Tables:ADD.
I am assuming I need to do something like:

chword:Selection:Tables:ADD(Slection:range,1,1,wdWord9TableBehavior,wdAutoFitFixed).

Any ideas?

Thanks
 

D.Cook

Member
I'm pretty sure the named constants will not be evaluated -- you'll need to pass the actual integer value. To find out the integer values, probably just use the following VBAscript or similar:
Code:
MsgBox(wdWord9TableBehavior & " " & wdAutoFitFixed)

Then just substitute the constant name with the integer value like so (where 1234 is the value you got from the MsgBox command):

Code:
chword:Selection:Tables:ADD(Slection:range,1,1, /*wdWord9TableBehavior*/ 1234, /*wdAutoFitFixed*/ 1234).
 
Top