title: Generate Table (row and cells)
body: <p>I have the VB.net code, but I need to convert it to VBScript. I need to open a word document count the tables and if there is a Word like (e.g. Tablein) I need to replace it with a table. But the table has to be built as the data is provided.</p>
  
  <p>VB.net code (full code):</p>
  
  <pre><code>dim oRow As Word.Row,oTable As Word.Table
  oRow = oTable.Rows(1)
  oRow.Cells(1).Range.Text = ""
  If PullRow.Item("TYPE").ToString = "Traffic" Then
  oRow.Cells(2).Range.Text = "T"
  ElseIf PullRow.Item("TYPE").ToString = "Data" Then
  oRow.Cells(2).Range.Text = "D"
  End If
  oRow.Cells(3).Range.Text = "C"
  </code></pre>
  
  <p>VBScript (Till I could write):</p>
  
  <pre class="lang-vbs prettyprint-override"><code>Dim intNoOfRows
  
  Dim intNoOfColumns
  
  Dim objWord
  
  Dim objDoc
  
  Dim objRange
  
  Dim objTable
  dim strword
  
  intNoOfRows = 5
  
  intNoOfColumns = 3
  
  Set objWord = CreateObject("Word.Application")
  
  objWord.Visible = True    
  
  Set objDoc = objWord.Documents.open("new.docx")
  
  g= objWord.ActiveDocument.Tables.count
  
  Set objRange = objDoc.Range
  
  Set objTable = objDoc.Tables(1)
  objTable.Borders.Enable = True   
  
  With objWord.Selection
    .Find.Text = "pen"
    .Find.Forward = True
    .Find.MatchWholeWord = True
    Do
      found = .Find.Execute 
  
      If found Then objDoc.Tables.Add objRange, 2,2
    Loop While found
  
  End With
  </code></pre>