[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Re: Ruby & Word 2007 help

David Mullet

8/23/2007 12:48:00 PM

Inge Zwart wrote:
>
> doc = wrd.Documents.Open(File.expand_path(file))
>

I'm assuming the same code ran on the same files (or copies of) using
Word 2003, and so the only change has been the version of Word.

I am not running Word 2007, so I couldn't test this, but I couldn't find
any evidence/discussion online of changes to the Documents.Open method
for 2007.

The Microsoft Word 2007 documentation for the Documents.Open method is
here:

http://msdn2.microsoft.com/en-us/library/bb2...

Just guessing, but you might try passing optional parameters, such as:

doc = wrd.Documents.Open(File.expand_path(file), false, true)

David

http://rubyonwindows.bl...

--
Posted via http://www.ruby-....

16 Answers

Inge Zwart

8/23/2007 1:27:00 PM

0

David,

Thanks for your help. I tried changing the Open code and this is the error I received:

Batchmacro.rb:16:in 'method_missing': Open (WIN30LERuntineError)
OLE error code:800A1436 in Microsoft Word
(C:\/daily%20print%20batch/Corzo%20Jr...)
HRESULT error code:0x80020009
from batchmacro.rb:15:in 'each'
from batchmacro.rb:15

Inge H. Zwart, RN, BSN
TeleTrans, Inc.
Medical Transcription Specialists since 1989
Phone: 623-505-4423 / 877-495-9041
Fax: 623-505-4423
-----Original Message-----
From: list-bounce@example.com [mailto:list-bounce@example.com] On Behalf Of David Mullet
Sent: Thursday, August 23, 2007 6:48 AM
To: ruby-talk ML
Subject: Re: Ruby & Word 2007 help

Inge Zwart wrote:
>
> doc = wrd.Documents.Open(File.expand_path(file))
>

I'm assuming the same code ran on the same files (or copies of) using
Word 2003, and so the only change has been the version of Word.

I am not running Word 2007, so I couldn't test this, but I couldn't find
any evidence/discussion online of changes to the Documents.Open method
for 2007.

The Microsoft Word 2007 documentation for the Documents.Open method is
here:

http://msdn2.microsoft.com/en-us/library/bb2...

Just guessing, but you might try passing optional parameters, such as:

doc = wrd.Documents.Open(File.expand_path(file), false, true)

David

http://rubyonwindows.bl...

--
Posted via http://www.ruby-....


David Mullet

8/23/2007 3:40:00 PM

0

Inge Zwart wrote:
> David,
>
> Thanks for your help. I tried changing the Open code and this is the
> error I received:
>
> Batchmacro.rb:16:in 'method_missing': Open (WIN30LERuntineError)
> OLE error code:800A1436 in Microsoft Word
> (C:\/daily%20print%20batch/Corzo%20Jr...)
> HRESULT error code:0x80020009
> from batchmacro.rb:15:in 'each'
> from batchmacro.rb:15
>

Double-check the filename string that is being passed to the
Documents.Open method. It may be getting mangled somewhere along the
line, with regard to backslashes and/or spaces.

David

http://rubyonwindows.bl...
--
Posted via http://www.ruby-....

David Mullet

8/23/2007 3:42:00 PM

0

Craig Demyanovich wrote:
> The documentation for Documents.Open lists two required parameters. The
> first one is FileName, and the second is Format. What's strange, though,
> is
> that Format is listed both as optional and required. Is that just a
> typo,
> since the description for each listing of the Format parameter is very
> similar?

I suspect that it is a typo, for the reason you mentioned. Also,
required parameters are usually (in my experience) near the front of the
list.

David

http://rubyonwindows.bl...
--
Posted via http://www.ruby-....

Kyle Schmitt

8/23/2007 4:38:00 PM

0

Just a quick hint, since it's saved me a few times when the MSDN site
didn't have good info, use the ole_get_methods, or its analog
ole_methods.
The help method, ole_method_help(), usually doesn't do much other than
return the name of the method in my experience, but heck, try it :)
maybe you'll have more luck.

--Kyle

Masaki Suketa

8/23/2007 10:23:00 PM

0

Hello,

In message "Re: Ruby & Word 2007 help"
on 07/08/24, "Craig Demyanovich" <cdemyanovich@gmail.com> writes:

> I'm not sure what to do next, since File.expand_path() returns a path with
> forward slashes on Windows. Nevertheless, I hope that this information
> allows the next step toward a solution to be taken.

How about GetAbsolutePathName of Scripting.FileSystemObject?

fso = WIN32OLE.new("Scripting.FileSystemObject")
path = fso.GetAbsolutePathName("test.doc")
doc = word.Documents.Open(path)

Regards,
Masaki Suketa


Mick Miller

1/29/2008 5:15:00 PM

0

Mr Masaki,

The solution you suggested works!

I replaces the line:

doc = word.Documents.Open(File.expand_path(file))

with the three lines you suggested.

Thank you,
Mick

Masaki Suketa wrote:
> Hello,
>
> In message "Re: Ruby & Word 2007 help"
> on 07/08/24, "Craig Demyanovich" <cdemyanovich@gmail.com> writes:
>
>> I'm not sure what to do next, since File.expand_path() returns a path with
>> forward slashes on Windows. Nevertheless, I hope that this information
>> allows the next step toward a solution to be taken.
>
> How about GetAbsolutePathName of Scripting.FileSystemObject?
>
> fso = WIN32OLE.new("Scripting.FileSystemObject")
> path = fso.GetAbsolutePathName("test.doc")
> doc = word.Documents.Open(path)
>
> Regards,
> Masaki Suketa

--
Posted via http://www.ruby-....

Zev

2/17/2011 2:25:00 PM

0

On Feb 17, 3:53 pm, "heinrich" <heinr...@ruhrgasnet.de> wrote:
> "Zev" <zev_h...@yahoo.com> schreef in berichtnews:cca5976d-9f4d-4134-ae8f-e68a8f41448c@x21g2000vbn.googlegroups.com...
>
> > "heinrich" <heinr...@ruhrgasnet.de> wrote in message
> >news:rQ57p.4957$4g3.4050@newsfe04.iad...
> >>http://www.telegraph.co.uk/news/newstopics/world-war-2/8329......
>
> > Suicide?
> > Sure?
>
> >http://www.fpp.co.uk/Himmler/death/PRO_docs_...
>
> > BTW, I didn't believe non-suicide either,
> > but this makes too much sense to ignore.
>
> http://www.thesun.co.uk/sol/homepage/news/3416070/Adolf-Hit......

No argument about that, the question is how.
Go to the link, tell me if it makes sense to you.

Heinrich

2/17/2011 2:29:00 PM

0



"Zev" <zev_horn@yahoo.com> schreef in bericht
news:f9e8b437-a815-47be-8f63-5ba0523a5567@c10g2000vbv.googlegroups.com...
> On Feb 17, 3:53 pm, "heinrich" <heinr...@ruhrgasnet.de> wrote:
>> "Zev" <zev_h...@yahoo.com> schreef in
>> berichtnews:cca5976d-9f4d-4134-ae8f-e68a8f41448c@x21g2000vbn.googlegroups.com...
>>
>> > "heinrich" <heinr...@ruhrgasnet.de> wrote in message
>> >news:rQ57p.4957$4g3.4050@newsfe04.iad...
>> >>http://www.telegraph.co.uk/news/newstopics/world-war-2/8329......
>>
>> > Suicide?
>> > Sure?
>>
>> >http://www.fpp.co.uk/Himmler/death/PRO_docs_...
>>
>> > BTW, I didn't believe non-suicide either,
>> > but this makes too much sense to ignore.
>>
>> http://www.thesun.co.uk/sol/homepage/news/3416070/Adolf-Hit......
>
> No argument about that, the question is how.
> Go to the link, tell me if it makes sense to you.
>

as far as I know he took a suicide pill just before he would have been
questioned by the british. he was burried on the Luenenburger Heide

NEMO

2/17/2011 3:53:00 PM

0

"heinrich" & "Zev", 2 luls debating the suicide of a 3rd. lul,
Heinrich Himmler! (& Heinrich Himmler never looked better - so life
like!)

LOL ROTFL LMAO

The Peeler

2/17/2011 7:24:00 PM

0

On Thu, 17 Feb 2011 07:53:04 -0800 (PST), NEMO wrote:

> "heinrich" & "Zev", 2 luls debating the suicide of a 3rd. lul,
> Heinrich Himmler! (& Heinrich Himmler never looked better - so life
> like!)
>
> LOL ROTFL LMAO

LOL! Well put!


--
Dumb Dutch Nazi Heini about his personal misery: "I FEEL LONELY AT THE
MOMENT, IT IS RAining again and the sky is grey so a perfect scenbario to
commit suicide"
Message-ID: <vegVo.11791$jj5.10722@newsfe03.iad>