Results 1 to 3 of 3

Thread: How to Create Table In Ms words

  1. #1

    Thread Starter
    Member
    Join Date
    Jun 2003
    Posts
    46

    Question How to Create Table In Ms words

    Hi
    I have to Generate the report in tabular form in Words

    how to do it??

  2. #2
    Evil Genius alex_read's Avatar
    Join Date
    May 2000
    Location
    Espoo, Finland
    Posts
    5,538
    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:
    1. Private Sub CommandButton1_Click()
    2.     Dim rngDefault As Range
    3.     Dim tblTest As Table
    4.    
    5.     Set rngDefault = ActiveDocument.Range(Start:=0, End:=0)
    6.     Set tblTest = ActiveDocument.Tables.Add _
    7.     (Range:=rngDefault, numrows:=1, numcolumns:=3)
    8.    
    9.     With tblTest
    10.         .Rows(1).Cells(1).Select
    11.         Selection.Text = "1"
    12.        
    13.         .Rows(1).Cells(2).Select
    14.         Selection.Text = "2"
    15.        
    16.         .Rows(1).Cells(3).Select
    17.         Selection.Text = "3"
    18.     End With
    19. End Sub

    Please rate this post if it was useful for you!
    Please try to search before creating a new post,
    Please format code using [ code ][ /code ], and
    Post sample code, error details & problem details

  3. #3

    Thread Starter
    Member
    Join Date
    Jun 2003
    Posts
    46
    Thanks it work really fine

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width