How do I run an Excel macro from Ruby?
All you need to provide the OLE module is the macro name
excel.run('WriteToA1')
Also note, if you want to run a macro with an arguement, you use:
excel.run('MarcoWithArgs', "Arg")
Run ruby script through vba
The comment section made it clear: fully qualify your parameters, if they are files, and the files are not in the same directory as your Excel sheet.
Shell("ruby C:\Folder\dostuff.rb C:\Folder\file1.csv C:\Folder\file2.csv", vbNormalFocus)
Matlab doesn't run Excel macro
Okay the problem came from this line ExcelApp.Run("ThisWorkbook.hello");
and I needed to write ExcelApp.Run('hello');
instead.
So ThisWorkbook didn't work as well as the double quote.
Ruby Sketchup, get a value from an open excel workbook
Use this way
excel = WIN32OLE.connect("excel.application")
workbook = excel.Workbooks('workbook name')
worksheet = workbook.Worksheets('Sheet1')
Unexpected behavior using the run method for win32ole excel object
The syntax to pass an argument to a VBA macro seems to be
excel.run('Itakeargs', '1')
Still, the observed (and reproducable) behaviour is somewhat strange.
Related Topics
Ruby, Generate a Random Hex Color (Only Light Colors)
Ruby Looks for Class Variable in the Object Instead of Specific Class
Require Ruby File Without .Rb Extension
Losing an Attribute When Saving Through an Association W/ Scope (Rails 4.0.0)
Rvm Install Ruby-1.9.3-P286: Error Running 'Make -J 9' (Osx: Mountain Lion)
Using Local Variables in Define_Method
Have Delayed_Job Log "Puts", SQL Queries and Jobs Status
Handle Check Box Forms with an ':Has_Many :Through' Record Association
Having Difficulty Accessing Validation Errors in Sinatra
Why Does 'Puts(Nil or 4)' Fail in Ruby
Marshal Ruby Hash with Default Proc - Remove the Default Proc
Could Not Find Gem 'Logstash-Devutils (>= 0) Ruby' in Any of the Gem Sources
Conditional Page Caching [Solution: Conditional Fragment Caching]
Why Won't Ruby Allow Me to Specify Self as a Receiver Inside a Private Method