R
Robin Tucker
Hi,
I am embedding various things into a Microsoft Word document. I want to
embed and automate a chart control. I can embed an Excel.Chart.8 into my
Word document manually (no problemo), but I cannot find this control on the
"Add/Remove Components..." dialog in the VB.NET editor. What I want to do
is use automation to create an Excel.Chart.8, then using the reference
returned, build a graph from my VB.NET program. What do I cast it to and
what/how do I get the approriate Excel references into my software (at
present, to get Word, I have "Microsoft.Office.Core", "Office" and "Word"
references). What do I include for Excel?
' In my VB.NET code I write the following (to embed a graph):
Dim theNewShape As InlineShape = m_Document.InlineShapes.AddOLEObject
(ClassType:="Excel.Chart.8", _
FileName:="", _
LinkToFile:=False, _
DisplayAsIcon:=False, _
Range:=m_Application.Selection.Range)
' Set its size...
theNewShape.Width = theShape.Width
theNewShape.Height = theShape.Height
' Store a reference to the OLE for later...
m_TrendOLE = CType(theNewShape.OLEFormat.Object, ?????????????????)
' Build the graph (my function to build the graph in the Word Document using
Automation...)
BuildTheGraph(m_TrendOLE)
I am embedding various things into a Microsoft Word document. I want to
embed and automate a chart control. I can embed an Excel.Chart.8 into my
Word document manually (no problemo), but I cannot find this control on the
"Add/Remove Components..." dialog in the VB.NET editor. What I want to do
is use automation to create an Excel.Chart.8, then using the reference
returned, build a graph from my VB.NET program. What do I cast it to and
what/how do I get the approriate Excel references into my software (at
present, to get Word, I have "Microsoft.Office.Core", "Office" and "Word"
references). What do I include for Excel?
' In my VB.NET code I write the following (to embed a graph):
Dim theNewShape As InlineShape = m_Document.InlineShapes.AddOLEObject
(ClassType:="Excel.Chart.8", _
FileName:="", _
LinkToFile:=False, _
DisplayAsIcon:=False, _
Range:=m_Application.Selection.Range)
' Set its size...
theNewShape.Width = theShape.Width
theNewShape.Height = theShape.Height
' Store a reference to the OLE for later...
m_TrendOLE = CType(theNewShape.OLEFormat.Object, ?????????????????)
' Build the graph (my function to build the graph in the Word Document using
Automation...)
BuildTheGraph(m_TrendOLE)