Add a Formatted Table to a Word Document

白洋淀水生花卉

白洋淀水生花卉

2016-02-19 09:24

今天图老师小编要跟大家分享Add a Formatted Table to a Word Document,精心挑选的过程简单易学,喜欢的朋友一起来学习吧!
Demonstration script that retrieves service data from a computer and 
then displays that data in a formatted table in Microsoft Word. 
代码如下:

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 & "rootcimv2")
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




展开更多 50%)
分享

猜你喜欢

Add a Formatted Table to a Word Document

Web开发
Add a Formatted Table to a Word Document

Add a Table to a Word Document

Web开发
Add a Table to a Word Document

s8lol主宰符文怎么配

英雄联盟 网络游戏
s8lol主宰符文怎么配

Add Formatted Text to a Word Document

Web开发
Add Formatted Text to a Word Document

Add a Picture to a Microsoft Word Document

Web开发
Add a Picture to a Microsoft Word Document

lol偷钱流符文搭配推荐

英雄联盟 网络游戏
lol偷钱流符文搭配推荐

Open and Print a Word Document

Web开发
Open and Print a Word Document

document.open() 与 document.write()的区别

Web开发
document.open() 与 document.write()的区别

lolAD刺客新符文搭配推荐

英雄联盟
lolAD刺客新符文搭配推荐

mysql 发生系统错误1067的解决方法

mysql 发生系统错误1067的解决方法

Save a File Using a File Save Dialog Box

Save a File Using a File Save Dialog Box
下拉加载更多内容 ↓