在word中如何控制graph控件

作者:袖梨 2022-07-02
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

相关文章

精彩推荐