Demonstration script that retrieves network adapter the data from a computer,
Displays that data in a Microsoft Word document, and then saves the
Document as C:\Scripts\Word\Testdoc.doc.
Copy Code code as follows:
Set objword = CreateObject ("Word.Application")
Objword.caption = "Test Caption"
Objword.visible = True
Set objdoc = OBJWORD.DOCUMENTS.ADD ()
Set objselection = objword.selection
ObjSelection.Font.Name = "Arial"
ObjSelection.Font.Size = "18"
Objselection.typetext "Network Adapter"
Objselection.typeparagraph ()
ObjSelection.Font.Size = "14"
Objselection.typetext "" & Date ()
Objselection.typeparagraph ()
Objselection.typeparagraph ()
ObjSelection.Font.Size = "10"
StrComputer = "."
Set objWMIService = GetObject ("winmgmts:\\" & StrComputer & "\root\cimv2")
Set Colitems = objWMIService.ExecQuery _
("SELECT * FROM Win32_NetworkAdapterConfiguration")
For each objitem in colitems
ObjSelection.Font.Bold = True
Objselection.typetext "ARP Always Source Route:"
ObjSelection.Font.Bold = False
Objselection.typetext "" & Objitem.arpalwayssourceroute
Objselection.typeparagraph ()
ObjSelection.Font.Bold = True
Objselection.typetext "ARP use Ethersnap:"
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 "Database Path:"
ObjSelection.Font.Bold = False
Objselection.typetext "" & Objitem.databasepath
Objselection.typeparagraph ()
ObjSelection.Font.Bold = True
Objselection.typetext "Dead GW detection Enabled:"
ObjSelection.Font.Bold = False
Objselection.typetext "" & objitem.deadgwdetectenabled
Objselection.typeparagraph ()
ObjSelection.Font.Bold = True
Objselection.typetext "Default IP Gateway:"
ObjSelection.Font.Bold = False
Objselection.typetext "" & Objitem.defaultipgateway
Objselection.typeparagraph ()
ObjSelection.Font.Bold = True
Objselection.typetext "Default TOS:"
ObjSelection.Font.Bold = False
Objselection.typetext "" & Objitem.defaulttos
Objselection.typeparagraph ()
ObjSelection.Font.Bold = True
Objselection.typetext "Default TTL:"
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:\Scripts\Word\testdoc.doc")
Objword.quit