Excel VBA:使用哪个 OLE/OCX 控件在表单中显示图表?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/412920/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Excel VBA: Which OLE/OCX control to use to display a chart in a form?
提问by Kshitij
I have to display a column chart in a user form in VBA. Exporting the chart to GIF and importing in a picture box works; but I cannot use it because the chart needs to be modified based on options chosen by the user from the same form. I have been searching and people have commented that default OLE/OCX controls provided by MS may be used. I cannot find an ActiveX which may do the trick. Does somebody know which controls to use and how to use them?
我必须在 VBA 的用户表单中显示柱形图。将图表导出为 GIF 并导入到图片框中即可;但我无法使用它,因为图表需要根据用户从同一表单中选择的选项进行修改。我一直在搜索,人们评论说可以使用 MS 提供的默认 OLE/OCX 控件。我找不到可以解决问题的 ActiveX。有人知道要使用哪些控件以及如何使用它们吗?
采纳答案by Joel Spolsky
Just use Microsoft Chart, it's the same engine as Microsoft Excel.
只需使用 Microsoft Chart,它与 Microsoft Excel 的引擎相同。
Assuming you're using Excel 2003 ... the control is called "Microsoft Office Chart 11.0"
假设您使用的是 Excel 2003 ...该控件称为“Microsoft Office Chart 11.0”
If you have Excel 2007, Microsoft did not ship the chart control. But you can still download Microsoft Office Chart 11.0. It's in a file called OWC11.EXE.
如果您有 Excel 2007,Microsoft 没有提供图表控件。但是您仍然可以下载 Microsoft Office Chart 11.0。它位于名为 OWC11.EXE 的文件中。
Then, in the VBA editor, when your VBA UserForm is showing, right click on the toolbox and choose "Additional Controls" and then check "Microsoft Office Chart 11.0" from the list that appears.
然后,在 VBA 编辑器中,当您的 VBA 用户窗体显示时,右键单击工具箱并选择“其他控件”,然后从出现的列表中选中“Microsoft Office Chart 11.0”。
回答by Robert
As owner of Gigasoft, please include Gigasoft's Charting ActiveXswithin your research. The above link goes to a complete Excel 2013 walkthrough. Or see Access 2013 Charting ActiveX Walkthroughfor use within Access.
作为 Gigasoft 的所有者,请在您的研究中包括Gigasoft 的图表 ActiveX。上述链接转到完整的 Excel 2013 演练。或参阅Access 2013 Charting ActiveX 演练以在 Access 中使用。
Excel...
优秀...
Access..
使用权..
回答by Jon Fournier
You might want to try this if you just need 2D graphing:
如果您只需要 2D 图形,您可能想试试这个: