You tell us your script "does not output what I want" but don't tell us what that output was. It might have been helpful.

I would establish that it is in fact Win32::OLE that is locking up your laptop and one way to do that is write your script without it. :-)

Put your script to one side for a moment and write a short script that demonstrates that you can find the files you want to work with. You refer to a sample_folder at the top of the script (with a path relative to your script - where is your script?) and in the loop you look in parent_folder (with a full path - a better way to go). Is that correct? If it is you would need more error checking.

Perhaps something like the following would help you see what the script is actually doing (adding print statements) and then adjust if necessary.

#!/usr/bin/perl use strict; use warnings; my $directory = q{C:/Users/john/Documents/sample_folder}; opendir my $dh, $directory or die qq{cant open *$directory*}; my @dir_list = grep {/^EN-US_.+/ && -d qq{$directory/$_} } readdir $dh +; # does this print what you expect? print qq{dir_list: $directory\n}; print qq{$_\n} for @dir_list; print qq{*****\n}; for my $dir (@dir_list){ my $doc = sprintf(q{%s/%s/sample_doc.doc}, $directory, $dir); # are these the right files? print qq{$doc\n}; if (-f $doc){ print qq{found\n}; } else{ print qq{not found\n}; } }
When you're sure you can see the files you need then perhaps another short script using Win32::OLE to open one of the files and get at the table cells.

Get both working nicely and then put them together.


In reply to Re: WIN32::OLE MS WORD TABLE CELL READING PERL by wfsp
in thread WIN32::OLE MS WORD TABLE CELL READING PERL by pooTan

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.