displaysthatdatainaMicrosoftWorddocument,andthensavesthe
documentasC:ScriptsWordTestdoc.doc.
复制代码 代码如下:
SetobjWord=CreateObject("Word.Application")
objWord.Caption="TestCaption"
objWord.Visible=True
SetobjDoc=objWord.Documents.Add()
SetobjSelection=objWord.Selection
objSelection.Font.Name="Arial"
objSelection.Font.Size="18"
objSelection.TypeText"NetworkAdapterReport"
objSelection.TypeParagraph()
objSelection.Font.Size="14"
objSelection.TypeText""&Date()
objSelection.TypeParagraph()
objSelection.TypeParagraph()
objSelection.Font.Size="10"
strComputer="."
SetobjWMIService=GetObject("winmgmts:"&strComputer&"rootcimv2")
SetcolItems=objWMIService.ExecQuery_
("Select*fromWin32_NetworkAdapterConfiguration")
ForEachobjItemincolItems
objSelection.Font.Bold=True
objSelection.TypeText"ARPAlwaysSourceRoute:"
objSelection.Font.Bold=False
objSelection.TypeText""&objItem.ArpAlwaysSourceRoute
objSelection.TypeParagraph()
objSelection.Font.Bold=True
objSelection.TypeText"ARPUseEtherSNAP:"
objSelection.Font.Bold=False
objSelection.TypeText""&objItem.ArpUseEtherSNAP
objSelection.TypeParagraph()
objSelection.Font.Bold=True
objSelection.TypeText"Caption:"
objSelection.Font.Bold=False
objSelection.TypeText""&objItem.Caption
objSelection.TypeParagraph()
objSelection.Font.Bold=True
objSelection.TypeText"DatabasePath:"
objSelection.Font.Bold=False
objSelection.TypeText""&objItem.DatabasePath
objSelection.TypeParagraph()
objSelection.Font.Bold=True
objSelection.TypeText"DeadGWDetectionEnabled:"
objSelection.Font.Bold=False
objSelection.TypeText""&objItem.DeadGWDetectEnabled
objSelection.TypeParagraph()
objSelection.Font.Bold=True
objSelection.TypeText"DefaultIPGateway:"
objSelection.Font.Bold=False
objSelection.TypeText""&objItem.DefaultIPGateway
objSelection.TypeParagraph()
objSelection.Font.Bold=True
objSelection.TypeText"DefaultTOS:"
objSelection.Font.Bold=False
objSelection.TypeText""&objItem.DefaultTOS
objSelection.TypeParagraph()
objSelection.Font.Bold=True
objSelection.TypeText"DefaultTTL:"
objSelection.Font.Bold=False
objSelection.TypeText""&objItem.DefaultTTL
objSelection.TypeParagraph()
objSelection.Font.Bold=True
objSelection.TypeText"Description:"
objSelection.Font.Bold=True
objSelection.Font.Bold=False
objSelection.TypeText""&objItem.Description
objSelection.TypeParagraph()
objSelection.TypeParagraph()
Next
objDoc.SaveAs("C:ScriptsWordtestdoc.doc")
objWord.Quit