Hello,
I am trying to write a simple script and all I need to do is check if
there is all ready a running instance of the word application. I look
and couldn't find much on google how to do this...which probably means
it's really easy, so I'm sorry for this post but I'm still learning
Thanks in advance for your help!
koooee
ยทยทยท
--
Posted via http://www.ruby-forum.com/.
Not Thisguy wrote:
Hello,
I am trying to write a simple script and all I need to do is check if
there is all ready a running instance of the word application. I look
and couldn't find much on google how to do this...which probably means
it's really easy, so I'm sorry for this post but I'm still learning
Thanks in advance for your help!
koooee
One option is to try to connect to a running instance of Word. If there
is no running instance of Word, a WIN32OLERuntimeError exception will be
raised. So you could do the following:
require 'win32ole'
begin
word = WIN32OLE.connect('Word.Application')
rescue WIN32OLERuntimeError
word = WIN32OLE.new('Word.Application')
word.Visible = true
end
David
ยทยทยท
--
Posted via http://www.ruby-forum.com/\.
David Mullet wrote:
One option is to try to connect to a running instance of Word. If there
is no running instance of Word, a WIN32OLERuntimeError exception will be
raised. So you could do the following:
require 'win32ole'
begin
word = WIN32OLE.connect('Word.Application')
rescue WIN32OLERuntimeError
word = WIN32OLE.new('Word.Application')
word.Visible = true
end
David
http://rubyonwindows.blogspot.com
Ruby on Windows: word
Awsome thank you so much!!
ยทยทยท
--
Posted via http://www.ruby-forum.com/\.