源码网商城,靠谱的源码在线交易网站 我的订单 购物车 帮助

源码网商城

Add a Formatted Table to a Word Document

  • 时间:2022-10-14 17:57 编辑: 来源: 阅读:
  • 扫一扫,手机访问
摘要: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. 
[u]复制代码[/u] 代码如下:
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
  • 全部评论(0)
联系客服
客服电话:
400-000-3129
微信版

扫一扫进微信版
返回顶部