>I am having problems automating a Word grid. This may be basic stuff for you guys but I am fairly new to this and I can't seem to sort it out. Does anybody have any ideas? Thanks in advance. Greg
>
>Here is my code ;
>
>#DEFINE True .T.
>#DEFINE False .F.
>
>&& Populates the grid
>WITH loTable
>FOR lnRow = 1 TO ALEN(laTableData, 1)
>FOR lnColumn = 1 TO ALEN(laTableData, 2)
>.Cell(lnRow,lnColumn).Range.InsertAfter(laTableData[lnRow,lnColumn])
>ENDFOR
>ENDFOR
>
>.AutoFormat ;
>(wdTableFormatGrid6, ;
> True, ;
> True, ;
> True, ;
> True, ;
> True, ;
> False, ;
> True, ;
> False, ;
> True)
>ENDWITH
>
>&& ERROR; 'variable wdTableFormatGrid6 is not found'
>
>=============================
>I have also tried:
>
>.AutoFormat ;
>Format:=wdTableFormatGrid6, ;
>ApplyBorders:= True, ;
>ApplyShading:=True, ;
>ApplyFont:=True, ;
>ApplyColor:=True, ;
>ApplyHeadingRows:=True, ;
>ApplyLastRow:=False, ;
>ApplyFirstColumn:=True,;
>ApplyLastColumn:=False, ;
>AutoFit:=True
>
>&& I get a Syntax error.
Greg,
wdTableFormatGrid6 is a VBA constant with a value of 21. Either define it or directly use 21.
#define wdTableFormatGrid1 16
#define wdTableFormatGrid2 17
#define wdTableFormatGrid3 18
#define wdTableFormatGrid4 19
#define wdTableFormatGrid5 20
#define wdTableFormatGrid6 21
#define wdTableFormatGrid7 22
#define wdTableFormatGrid8 23
Check files section for a file containing office constants.
Cetin