Questions tagged [win32ole]

Object Linking and Embedding (OLE) is a proprietary interface to Microsoft applications. Most notably the Microsoft Office suite.

Object Linking and Embedding is an API provided by Microsoft to allow for control operations with Microsoft Applications.

Perl can make use of this API using the Win32::OLE module. Ruby also has a WIN32OLE class which does much the same.

However the primary scripting language is VBA, and Microsoft supply a variety of examples via MSDN

May be synonymous with the OLE tag, although anyone specifying Win32::OLE (or WIN32OLE) is probably specifically using Ruby or Perl.

Ref: Wikipedia:OLE

213 questions
2
votes
2 answers

Unexpected behavior using the run method for win32ole excel object

I have the following bit of ruby code which works fine require 'WIN32OLE' excel = WIN32OLE.new('Excel.Application') excel.visible = true path = Dir.pwd + '\Testargs.xlsm' excel.workbooks.open(path) excel.run('IdontTakeargs') Where IdontTakeargs is…
Pynner
  • 1,007
  • 10
  • 22
2
votes
3 answers

Ruby program with win32ole does not work any more under Windows7 64bit

I have an old ruby program that extracts values from an excel file and stores the summary in another excel file. For that purpose, the program uses the library win32ole from Ruby. After switching to a new computer with Windows 7 64bit (instead of…
mliebelt
  • 15,345
  • 7
  • 55
  • 92
2
votes
2 answers

sending ctrl+c using sendkeys in ruby

I need to close the command prompt window using sendkeys function, but when I used the below code it did not work as running of some betch file is in progress so its not taking these below options. require 'win32ole' system("start…
wani
  • 51
  • 2
  • 8
2
votes
2 answers

Is it practical to call vbscript functions from Ruby using win32ole?

Is it practical to call a VBScript function, such as VBScript's Chr(charcode), from Ruby using win32ole? Background: While working out how to add some nicely formatted headers to an excel worksheet, I followed my standard operating procedure:…
Andrew Grimm
  • 78,473
  • 57
  • 200
  • 338
2
votes
2 answers

What is ths error in Ruby Watir (WIN32OLERuntimeError: unknown property or method `document')?

I have this code in Ruby waitr .. $LOAD_PATH.unshift File.join(File.dirname(__FILE__),'..') if $0 == __FILE__ require 'test/unit' require 'Watir' require 'Watir/contrib/enabled_popup' class TC_Dialog_Test
Adham
  • 63,550
  • 98
  • 229
  • 344
2
votes
1 answer

JRuby & Win32OLE -- how well do they work together?

I've been using Win32OLE extensively with MRI to automate MS Office. It works great, but I'm thinking of switching to JRuby to simplify installing apps on users' systems. With Win32OLE officially in JRuby 1.6, how well does it work? Should I be able…
David Lewis
  • 190
  • 1
  • 8
2
votes
1 answer

How do I reliably determine folder size using FileSystemObject.Size?

Trying to compute the size of a folder that could be very large, I used FileSystemObject.Size: #! perl use strict; use warnings; use 5.10.0; use File::Spec; use Win32::OLE; my $_fso; sub folder_size { my($folder) = @_; $_fso =…
Greg Bacon
  • 134,834
  • 32
  • 188
  • 245
2
votes
1 answer

Ruby win32ole - how to pass a VARIANT parameter?

I am trying to automate the Windows Task Scheduler using Ruby. I am using Ruby 1.8 under Windows Vista. The RegisterTaskDefintion method of the TaskFolder object takes two VARIANT parameters for the username and password. Any attempt to pass a…
bvanderw
  • 1,065
  • 2
  • 12
  • 20
2
votes
0 answers

Saving a Word document as UTF-8 encoded HTML

I'm having a Perl script which saves a Word document as a HTML one. The following code works: use strict; use Win32::OLE::Const 'Microsoft Word'; [...] $go_word_doc->SaveAs2({ FileName => $gs_html_name, FileFormat => wdFormatFilteredHTML …
JNM
  • 125
  • 9
2
votes
1 answer

Pointing a range at the end of a table cell

In a Perl CGI, using Win32::OLE, I need to insert several text lines in a table cell, but one by one. The different objects I use are : $go_document, the Word document $lo_table, the Word table $li_row and $li_col, the cell coordinates in the…
JNM
  • 125
  • 9
2
votes
1 answer

cant connect to remote machine using WMI and Perl

I'm trying to write a script that will get event log information off of a remote windows machine using the win32::ole module and a WMI query. I can ping the machine but no matter what my WMI connection always fails using the ConnectServer() method.…
MilqueToasted
  • 83
  • 2
  • 10
2
votes
1 answer

How to access TextBox object text in Word document using Ruby WIN32OLE

I just put together a small script for a team of users that collects all PDF and DOC* files in a directory and parses them for hyperlinks. The PDF section works as intended, however a difference between the Word doc I was given for design (plain…
adam reed
  • 2,024
  • 18
  • 24
2
votes
1 answer

Ruby - WIN32OLE function creation

I'm doing some word automation via ruby and am relatively inexperienced with it. I'm trying to functionise my code now and I am coming across this error NameError: undefined local variable or method `doc' for main:Object from (irb):148:in…
Cam B
  • 195
  • 2
  • 3
  • 12
2
votes
1 answer

Excel VBA ODBC Connection Query Parameters

I'd like to be able to access an Excel External ODBCConnection Query Parameters using VBA. The Connection definition window showing the connection query (command text) is also showing a Parameters... button. Clicking on it shows the "Parameters"…
tamersalama
  • 4,093
  • 1
  • 32
  • 35
2
votes
1 answer

Perl Win32::OLE Print all attributes of an AD object

I use the following code to get the value of the attribute NAME of an AD computer object: $compObj = Win32::OLE->GetObject("LDAP://cn=$computername,dc=test,dc=com"); print "$compObj->{Name}"; How can I get information of all the attributes stored…
user5197928
1 2
3
14 15