VBScript和多级OLE? [英] VBScript and multilevel OLE?
问题描述
所以我的问题对于你,如果有人有一些代码,我可以看看或者可能是一个教程,甚至可以告诉我,如果这是可能的。
根据图表,一些笔记是嵌入式的Excel对象,如第一条。
''http: //msdn.microsoft.com/en-us/library/aa213725(office.11).aspx
'http://msdn.microsoft.com/en-us/library/aa174298(office.11) .aspx
Dim wd''As Word.Applicatio
Dim shs'As InlineShapes
Dim objChart''作为Excel.Chart
Dim objSheet''作为Excel作为系列
设置wd = CreateObject(Word.Application)
wd.Documents打开C:\Docs\Doc1.docm
wd.Visible = True
设置shs = wd.ActiveDocument.InlineShapes
''这个例子中只有一个形状
shs(1).OLEFormat.Activate
''OLE对象包含
设置objOLE = shs(1).OLEFormat.Object
''图表和工作表
设置objChart = objOLE.Charts(chart1)
设置objSheet = objOLE.Worksheets(sheet1)
objSheet.Range(e1)=NewData
objSheet.Range (e2)= 11
objSheet.Range(e3)= 12
设置NewSrs = objChart.SeriesCollection.NewSeries
使用NewSrs
.Name == Sheet1!e1
.Values == Sheet1!e2:e3
结束
MS Graph的注释
'VBA:参考:Microsoft Graph xx Object Library
''图形对象模型:http://msdn.microsoft.com/en-us/library/aa198537(office.10).aspx
Dim shs''As InlineShapes
Dim objDS'' As Graph.DataSheet
Dim objOLE''As Graph.Chart
设置shs = ActiveDocument.InlineShapes
''OLE对象包含
shs 3).OLEFormat.Activate
设置objOLE = shs(3).OLEFormat.Object
设置objDS = objOLE.Application.DataSheet
''=角,行标题= 01,02 ...
''列标题= A0,B0 ...
''Cells = A1,B1 ... E9 ...
objDS.Range(E0 )=New
objDS.Range(E1)= 11
objDS.Range(E2)= 12
objDS.Range(E3)= 9
Set objDS = Nothing
Set objOLE = Nothing
Set shs = Nothing
I have made a vbscript to target some computers and do wmi queries on them, and my boss wants this data to be put inside a document. The problem is that this document is a Microsoft Word document with embedded excel objects inside it. Now I have searched wide and far on google on any way to target and manipulate an object inside and object with OLE, but I seem to be getting nowhere.
So my question to you is if someone has some code for this I could look over or maybe a tutorial, and quite possible even tell me if it is even possible?
Some notes based on the chart being an embedded Excel object, as first stated.
''http://msdn.microsoft.com/en-us/library/aa213725(office.11).aspx
''http://msdn.microsoft.com/en-us/library/aa174298(office.11).aspx
Dim wd ''As Word.Applicatio
Dim shs ''As InlineShapes
Dim objChart ''As Excel.Chart
Dim objSheet ''As Excel.Worksheet
Dim objOLE ''As Excel.Workbook
Dim NewSrs ''As Series
Set wd=CreateObject("Word.Application")
wd.Documents.Open "C:\Docs\Doc1.docm"
wd.Visible=True
Set shs = wd.ActiveDocument.InlineShapes
''Just the one shape in this example
shs(1).OLEFormat.Activate
''The OLE Object contained
Set objOLE = shs(1).OLEFormat.Object
''The chart and worksheet
Set objChart = objOLE.Charts("chart1")
Set objSheet = objOLE.Worksheets("sheet1")
objSheet.Range("e1") = "NewData"
objSheet.Range("e2") = 11
objSheet.Range("e3") = 12
Set NewSrs = objChart.SeriesCollection.NewSeries
With NewSrs
.Name = "=Sheet1!e1"
.Values = "=Sheet1!e2:e3"
End With
Notes for MS Graph
''VBA: Reference: Microsoft Graph x.x Object Library
''Graph Object Model: http://msdn.microsoft.com/en-us/library/aa198537(office.10).aspx
Dim shs ''As InlineShapes
Dim objDS ''As Graph.DataSheet
Dim objOLE ''As Graph.Chart
Set shs = ActiveDocument.InlineShapes
''The OLE Object contained
shs(3).OLEFormat.Activate
Set objOLE = shs(3).OLEFormat.Object
Set objDS = objOLE.Application.DataSheet
''00=Corners, Row titles = 01,02 ...
''Column titles = A0, B0 ...
''Cells = A1, B1 ... E9 ...
objDS.Range("E0") = "New"
objDS.Range("E1") = 11
objDS.Range("E2") = 12
objDS.Range("E3") = 9
Set objDS = Nothing
Set objOLE = Nothing
Set shs = Nothing
这篇关于VBScript和多级OLE?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!