http://qs321.pair.com?node_id=230706


in reply to Last cell?
in thread Using Win32::OLE and Excel - Tips and Tricks

Upon further investigation, I have found that this is not reliable if the columnar data is not of equal row size. It returns the last row of the right most column, which is incorrect in some cases.

The methods I used in the examples return the last row (over all) and the last column (over all) vs finding the location of the last cell in the last column

So, if the data on the worksheet is symmetric, your function works faster, however yours would not be reliable to, say, put edges around all the cells in a data set that has columns of different row sizes

C-.

---
Flex the Geek

Replies are listed 'Best First'.
last row/column
by Foggy Bottoms (Monk) on Jun 18, 2003 at 09:35 UTC
    If the method you'd come up originally doesn't work fine with non "square" sheets then what would you recommend.
    Furthermore, I can't seem to be able to make your original last row/column script work. The dos prompt tells me the following :
    Bareword "xlPrevious" not allowed while "strict subs" in use at D:\sou +rce\readExcel.pm line 30. Bareword "xlByRows" not allowed while "strict subs" in use at D:\sourc +e\readExcel.pm line 30. Bareword "xlPrevious" not allowed while "strict subs" in use at D:\sou +rce\readExcel.pm line 33. Bareword "xlByColumns" not allowed while "strict subs" in use at D:\so +urce\readExcel.pm line 33.
    What should I do ?

    edit (broquaint): changed <pre> to <code> tags

last row/column
by Foggy Bottoms (Monk) on Jun 18, 2003 at 09:37 UTC
    Sorry about the previous post - I found out what wasn't working about the xlPrevious and I included the
    use Win32::OLE::Const 'Microsoft Excel';
    line. Thanks again and great tutorial. How about PowerPoint someday ?

      That's actaully in the works. It's a little more hairy than Excel (which is actually the easiest of the Office suites, aside from maybe Outlook). I will probably post a MSWord and Powerpoint both over the next few months.

      I haven't had to do create a powerpoint specific project yet, so most of what I have is just snippets, but I've cranked out a couple of word related projects, and I'm trying to distill them down into a workable tutorial.

      Stay tuned.

      C-.

      ---
      Flex the Geek

        Let me know - I'm pretty interested because I've been working on OLE since the beginning of June and I'm starting to get the hang of it. I've explored PowerPoint a little but rather unsuccesfully (hence my question). As for Word, I thought it was pretty easy.
        Perhaps we can work together on some sort of OLE tips page. I'd be glad to share what I've learned so far.
        See you round...

        Sunt qui sciant

Re: Re: Last cell?
by Nkuvu (Priest) on Mar 04, 2003 at 23:01 UTC

    Interesting. I don't seem to have run into this, but I wasn't explicitly looking for it, either. I'll have to do some more research on the matter.