Jump to content
Sign in to follow this  
sigil

getting data from cells in MS Word

Recommended Posts

sigil

I'd like to get text from various cells in tables in an MS Word document. It seems that the most direct way to do this is with an object created by _WordCreate() or _WordAttach(). I'm able to create the object, but once I do that I don't know which properties and methods to use. I've looked at MSDN, but I don't understand it.

I tried this:

#include <word.au3>

$path=("path to word document")
$wObj=_wordcreate($path,1)
$wObj.tables.item(1).select.selectcell(1,2)

but the SelectCell action failed.

I've been running into a lot of trouble using COM objects in AutoIt. Where can I find a tutorial? I'm looking for something that's more extensive than the one in the helpfile.

Share this post


Link to post
Share on other sites
PsaltyDS

I'd like to get text from various cells in tables in an MS Word document. It seems that the most direct way to do this is with an object created by _WordCreate() or _WordAttach(). I'm able to create the object, but once I do that I don't know which properties and methods to use. I've looked at MSDN, but I don't understand it.

I tried this:

#include <word.au3>

$path=("path to word document")
$wObj=_wordcreate($path,1)
$wObj.tables.item(1).select.selectcell(1,2)

but the SelectCell action failed.

I've been running into a lot of trouble using COM objects in AutoIt. Where can I find a tutorial? I'm looking for something that's more extensive than the one in the helpfile.

Trouble with COM objects in AutoIt? Does that mean you have a version of the above code in VBScript or something that works fine?

:)

Edited by PsaltyDS

Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites
sigil

Trouble with COM objects in AutoIt? Does that mean you have a version of the above code in VBScript or something that works fine?

No, I have limited abilities with COM in general. How do I figure out which method I need to call? I don't even know if

$wObj.tables.item(1).select.selectcell(1,2)

is a real Word object; I got the select.selectcell part by recording a macro of what happens when I select a cell and then looking at the VBA code that was produced, and I got the tables.item(1) part from a piece of sample code at MSDN about putting text in cells. I'm guessing that I need to use these things to call the selectcell method. But I'm not sure, and I'd like to know where I can look for a solid introduction to using objects in my scripts.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×