Hi
I have to Generate the report in tabular form in Words
how to do it??:confused:
Printable View
Hi
I have to Generate the report in tabular form in Words
how to do it??:confused:
Here's the general idea - another way to do this is to record a macro in word, design a table, then stop the recording & look at the vb editor window to pinch the code Word / the macro has produced for you...
VB Code:
Private Sub CommandButton1_Click() Dim rngDefault As Range Dim tblTest As Table Set rngDefault = ActiveDocument.Range(Start:=0, End:=0) Set tblTest = ActiveDocument.Tables.Add _ (Range:=rngDefault, numrows:=1, numcolumns:=3) With tblTest .Rows(1).Cells(1).Select Selection.Text = "1" .Rows(1).Cells(2).Select Selection.Text = "2" .Rows(1).Cells(3).Select Selection.Text = "3" End With End Sub
Thanks it work really fine