为了自动化数据透视表,请帮助我,下面是我编写的代码。我目前无法创建图表
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}")
答案 0 :(得分:3)
这与Watir无关。 Watir推动浏览器。你想开Excel。这有助于:Automating Excel with Ruby
答案 1 :(得分:1)
进入excel并录制一个用于创建数据透视表的宏。然后查看宏源代码并将其转换为ruby或AutoIt或watir或其他您想要使用的其他内容......