欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

Add a Formatted Table to a Word Document

 更新時(shí)間:2007年06月15日 00:00:00   作者:  
Demonstration script that retrieves service data from a computer and 
then displays that data in a formatted table in Microsoft Word. 
復(fù)制代碼 代碼如下:

Set objWord = CreateObject("Word.Application")
objWord.Visible = True
Set objDoc = objWord.Documents.Add()

Set objRange = objDoc.Range()
objDoc.Tables.Add objRange,1,3
Set objTable = objDoc.Tables(1)

x=1

strComputer = "."
Set objWMIService = _
    GetObject("winmgmts:\\" & strComputer & "\root\cimv2")
Set colItems = objWMIService.ExecQuery("Select * from Win32_Service")

For Each objItem in colItems
    If x > 1 Then
        objTable.Rows.Add()
    End If
    objTable.Cell(x, 1).Range.Font.Bold = True
    objTable.Cell(x, 1).Range.Text = objItem.Name
    objTable.Cell(x, 2).Range.text = objItem.DisplayName
    objTable.Cell(x, 3).Range.text = objItem.State
    x = x + 1
Next




相關(guān)文章

最新評(píng)論