Following Snippet will inform you how to add a Text to the Tables in the Word document.
Set oWord = CreateObject("Word.Application")
oWord.Visible = True
Set oDoc = oWord.Documents.Add()
Set oRange = oDoc.Range()
oDoc.Tables.Add oRange,1,3
Set objTable = oDoc.Tables(1)
objTable.style = "Table Grid"
strComputer = "."
Set objWMIService = GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_Process")
nRow = 1
objTable.Cell(nRow, 1).Range.Font.Bold = True
objTable.Cell(nRow, 1).Range.Text = "Process"
objTable.Cell(nRow, 2).Range.Font.Bold = True
objTable.Cell(nRow, 2).Range.Text = "Description"
objTable.Cell(nRow, 3).Range.Font.Bold = True
objTable.Cell(nRow, 3).Range.Text = "Path"
For Each objItem in colItems
nRow = nRow + 1
objTable.Rows.Add()
objTable.Cell(nRow, 1).Range.Font.Bold = True
objTable.Cell(nRow, 1).Range.Text = objItem.Name
objTable.Cell(nRow, 2).Range.text = objItem.Description
If objItem.Executablepath <> "" then objTable.Cell(nRow, 3).Range.text = objItem.Executablepath
Next
No comments:
Post a Comment