Excel 2007 中数据透视图的自动化
您能否帮助我自动化数据透视图,下面是我编写的代码。我目前正陷入创建图表的困境
require "rubygems"
# require "watir" # Commented out by editor to the question, not by the OP
require 'win32ole'
excel=WIN32OLE.new("Excel.Application")
excel.visible=true
work_book=excel.Workbooks.Open("C:\\VAMSI\\PIVOTAL_CHART_CODE\\pivotal.xlsx")
worksheet = work_book.worksheets(1)
worksheet.range("a1").select
autoit= WIN32OLE.new("AutoItX3.Control")
autoit.Send("!n")
autoit.Send("!v")
autoit.Send("!t")
autoit.Send("{ENTER}")
Could you please help me in order to automate a pivot chart, below is the code which I had written. I'm currently stuck creating a chart
require "rubygems"
# require "watir" # Commented out by editor to the question, not by the OP
require 'win32ole'
excel=WIN32OLE.new("Excel.Application")
excel.visible=true
work_book=excel.Workbooks.Open("C:\\VAMSI\\PIVOTAL_CHART_CODE\\pivotal.xlsx")
worksheet = work_book.worksheets(1)
worksheet.range("a1").select
autoit= WIN32OLE.new("AutoItX3.Control")
autoit.Send("!n")
autoit.Send("!v")
autoit.Send("!t")
autoit.Send("{ENTER}")
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这与瓦蒂尔无关。 Watir 驱动浏览器。您想要驱动 Excel。这可能会有所帮助:使用 Ruby 自动化 Excel
This has nothing to do with Watir. Watir drives browsers. You want to drive Excel. This could help: Automating Excel with Ruby
进入 Excel 并记录一个用于创建数据透视图的宏。然后查看宏源代码并将其转换为 ruby 或 AutoIt 或 watir 或任何您喜欢使用的其他...
Go into excel and record a macro in which you create a pivot chart. Then look at the macro source code and convert it to ruby or AutoIt or watir or whatever else you feel like using...