ExcelHome技术论坛

 找回密码
 免费注册

QQ登录

只需一步,快速开始

快捷登录

搜索
EH技术汇-专业的职场技能充电站 妙哉!函数段子手趣味讲函数 Excel服务器-会Excel,做管理系统 Excel Home精品图文教程库
HR薪酬管理数字化实战 Excel 2021函数公式学习大典 Excel数据透视表实战秘技 打造核心竞争力的职场宝典
300集Office 2010微视频教程 数据工作者的案头书 免费直播课集锦 ExcelHome出品 - VBA代码宝免费下载
用ChatGPT与VBA一键搞定Excel WPS表格从入门到精通 Excel VBA经典代码实践指南
楼主: 守柔

[原创]WORD调用EXCEL.CHART

[复制链接]

TA的精华主题

TA的得分主题

发表于 2005-7-31 22:20 | 显示全部楼层
本帖已被收录到知识树中,索引项:Word协同
你着迷了,就入轨了,也不远了。 mrcrosoft的脚本编辑器我从来就没有安装,只装mrcrosoft的脚本调试工具,看来,啥时候也得装上了。

TA的精华主题

TA的得分主题

发表于 2007-1-31 17:15 | 显示全部楼层
[广告] VBA代码宝 - VBA编程加强工具 · VBA代码随查随用  · 内置多项VBA编程加强工具       ★ 免费下载 ★      ★使用手册
good

TA的精华主题

TA的得分主题

发表于 2007-2-2 22:40 | 显示全部楼层

TA的精华主题

TA的得分主题

发表于 2007-2-2 22:43 | 显示全部楼层

TA的精华主题

TA的得分主题

发表于 2007-2-5 18:29 | 显示全部楼层
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件       ★免费下载 ★       ★ 使用帮助
office2000中可以运行,就是图有点扁!

TA的精华主题

TA的得分主题

发表于 2007-3-15 14:07 | 显示全部楼层
[广告] Excel易用宝 - 提升Excel的操作效率 · Excel / WPS表格插件       ★免费下载 ★       ★ 使用帮助

thanks!

TA的精华主题

TA的得分主题

发表于 2007-10-11 04:20 | 显示全部楼层

太好了,这个实在是太好了。

TA的精华主题

TA的得分主题

发表于 2008-2-25 16:20 | 显示全部楼层
请教高手,下面的代码为什么不能够执行啊?老是在ActiveChart.SeriesCollection(1).XValues = "=(Left(Values,1000))"这里报错?谢谢!
Sub test()
'
' test Macro
' Macro recorded 2008-2-25 by Roger_Dong

    Dim Values As String
    Values = ""
    
    Sheets("ROGER").Select
    Charts("SALLY").Select
    ActiveChart.ApplyCustomType ChartType:=xlBuiltIn, TypeName:= _
        "Line - Column on 2 Axes"
    ActiveChart.SetSourceData Source:=Sheets("ROGER").Range("E15")
    ActiveChart.SeriesCollection.NewSeries
    ActiveChart.SeriesCollection.NewSeries
    For i = 2 To 7
        If Sheets("ROGER").Cells(5, i).Value <> "" Then
           Select Case i
                 Case 2: Values = Values + "ROGER!R4C2,"
                 Case 3: Values = Values + "ROGER!R4C3,"
                 Case 4: Values = Values + "ROGER!R4C4,"
                 Case 5: Values = Values + "ROGER!R4C5,"
                 Case 6: Values = Values + "ROGER!R4C6,"
                 Case 7: Values = Values + "ROGER!R4C7"
          End Select
                     
        End If
    Next
    
    ActiveChart.SeriesCollection(1).XValues = "=(Left(Values,1000))"
    
    ActiveChart.SeriesCollection(1).Values = "=(ROGER!R5C2,ROGER!R5C4,ROGER!R5C6)"
    ActiveChart.SeriesCollection(1).Name = "=ROGER!R5C1"
    
    ActiveChart.SeriesCollection(2).Values = "=(ROGER!R6C2,ROGER!R6C4,ROGER!R6C6)"
    ActiveChart.SeriesCollection(2).Name = "=ROGER!R6C1"
    
    With ActiveChart
        .HasTitle = True
        .ChartTitle.Characters.text = "AMAX MES"
        .Axes(xlCategory, xlPrimary).HasTitle = True
        .Axes(xlCategory, xlPrimary).AxisTitle.Characters.text = "DDD "
        .Axes(xlValue, xlPrimary).HasTitle = True
        .Axes(xlValue, xlPrimary).AxisTitle.Characters.text = "YYYY"
        .Axes(xlCategory, xlSecondary).HasTitle = False
        .Axes(xlValue, xlSecondary).HasTitle = False
    End With
    ActiveChart.HasLegend = True
    ActiveChart.Legend.Select
    Selection.Position = xlCorner
    ActiveChart.HasDataTable = True
    ActiveChart.DataTable.ShowLegendKey = True
    Charts.Add
End Sub

TA的精华主题

TA的得分主题

 楼主| 发表于 2008-2-26 05:40 | 显示全部楼层
QUOTE:
以下是引用rogerisally在2008-2-25 16:20:00的发言:
请教高手,下面的代码为什么不能够执行啊?老是在ActiveChart.SeriesCollection(1).XValues = "=(Left(Values,1000))"这里报错?谢谢!
Sub test()
'
' test Macro
' Macro recorded 2008-2-25 by Roger_Dong

    Dim Values As String
    Values = ""
    
    Sheets("ROGER").Select
    Charts("SALLY").Select
    ActiveChart.ApplyCustomType ChartType:=xlBuiltIn, TypeName:= _
        "Line - Column on 2 Axes"
    ActiveChart.SetSourceData Source:=Sheets("ROGER").Range("E15")
    ActiveChart.SeriesCollection.NewSeries
    ActiveChart.SeriesCollection.NewSeries
    For i = 2 To 7
        If Sheets("ROGER").Cells(5, i).Value <> "" Then
           Select Case i
                 Case 2: Values = Values + "ROGER!R4C2,"
                 Case 3: Values = Values + "ROGER!R4C3,"
                 Case 4: Values = Values + "ROGER!R4C4,"
                 Case 5: Values = Values + "ROGER!R4C5,"
                 Case 6: Values = Values + "ROGER!R4C6,"
                 Case 7: Values = Values + "ROGER!R4C7"
          End Select
                     
        End If
    Next
    
    ActiveChart.SeriesCollection(1).XValues = "=(Left(Values,1000))"
    
    ActiveChart.SeriesCollection(1).Values = "=(ROGER!R5C2,ROGER!R5C4,ROGER!R5C6)"
    ActiveChart.SeriesCollection(1).Name = "=ROGER!R5C1"
    
    ActiveChart.SeriesCollection(2).Values = "=(ROGER!R6C2,ROGER!R6C4,ROGER!R6C6)"
    ActiveChart.SeriesCollection(2).Name = "=ROGER!R6C1"
    
    With ActiveChart
        .HasTitle = True
        .ChartTitle.Characters.text = "AMAX MES"
        .Axes(xlCategory, xlPrimary).HasTitle = True
        .Axes(xlCategory, xlPrimary).AxisTitle.Characters.text = "DDD "
        .Axes(xlValue, xlPrimary).HasTitle = True
        .Axes(xlValue, xlPrimary).AxisTitle.Characters.text = "YYYY"
        .Axes(xlCategory, xlSecondary).HasTitle = False
        .Axes(xlValue, xlSecondary).HasTitle = False
    End With
    ActiveChart.HasLegend = True
    ActiveChart.Legend.Select
    Selection.Position = xlCorner
    ActiveChart.HasDataTable = True
    ActiveChart.DataTable.ShowLegendKey = True
    Charts.Add
End Sub

请上传您的测试工作薄。

TA的精华主题

TA的得分主题

发表于 2009-2-20 17:11 | 显示全部楼层
您需要登录后才可以回帖 登录 | 免费注册

本版积分规则

手机版|关于我们|联系我们|ExcelHome

GMT+8, 2024-4-28 16:20 , Processed in 0.038726 second(s), 8 queries , Gzip On, MemCache On.

Powered by Discuz! X3.4

© 1999-2023 Wooffice Inc.

沪公网安备 31011702000001号 沪ICP备11019229号-2

本论坛言论纯属发表者个人意见,任何违反国家相关法律的言论,本站将协助国家相关部门追究发言者责任!     本站特聘法律顾问:李志群律师

快速回复 返回顶部 返回列表