在word中如何控制graph控件

发表于:2007-06-30来源:作者:点击数: 标签:
Dim objShape As Word.InlineShape Dim objChart As Object Dim objDataSheet As Object Dim axis As Graph.Axis Dim strKey as string @#bookmark的名称 @#首先要在word中嵌入一个graph,然后把这个graph添加一个bookMark(书签),名字就是strKey的内容 objSh
Dim objShape As Word.InlineShape
        Dim objChart As Object
        Dim objDataSheet As Object
        Dim axis As Graph.Axis

        Dim strKey as string                       @#bookmark的名称

       @#首先要在word中嵌入一个graph,然后把这个graph添加一个bookMark(书签),名字就是strKey的内容

       objShape = mobjDoc.Bookmarks.Item(strKey).Range.InlineShapes.Item(1)
       objShape.OLEFormat.DoVerb(VerbIndex:=Word.WdOLEVerb.wdOLEVerbHide)
       objChart = objShape.OLEFormat.Object()

       @#设置横轴的属性   

       axis = objChart.Axes(2, 1)

       @#最小刻度
       axis.MinimumScale = 0

       @#主要刻度单位
       axis.MajorUnit = 10

       @#次要刻度单位
       axis.MinorUnit = 10

       @#最大刻度
       axis.MaximumScale = 50

      @#在graph的表格中填写内容

       objDataSheet = objChart.Application.DataSheet
       objDataSheet.Cells(1, 1) = "aa"

       @#对表格进行更新

       objChart.Application.Update()

       @#退出graph程序
       objChart.Application.QUIT()


原文转自:http://www.ltesting.net