Re: Getting info from word using macros
- From: "Ed" <ed_millis@xxxxxxxxxxxxxxxxx>
- Date: Tue, 27 Sep 2005 09:44:34 -0700
If you've got many Word files and only one Excel file, you might be better
off recording macros in Word that reference the single Excel file, rather
than trying to create a program that references all the separate Word files.
Read all the below, think through it in your mind first, and maybe even try
it a few times without recording it.
In the Word VBE, you'd set a reference to the Excel library, then set
objects to your Excel application and Excel master file in your macro. Pull
up a Word doc. Highlight *Platform*: and copy, the CTRL+Home. Select
Record New Macro, CTRL+F, paste, Enter. This should take you to *Platform*:
.. Hit the Right Arrow.
Now is the tricky part. Is the portion you want for a data point always the
same length, or at least filling the same number of spaces? Or can you
CTRL+Shift+End to get to the end of the line with all of AND ONLY your data
point selected?
I'm suggesting this method because what I see in your response is a
text-based document, rather than a table-based doc. If you have Word docs
that are all formatted different from each other, writing one macro to fit
all of them is very difficult. If you have a few different formats, you can
get by with a few different macros.
Again, the key is consistency. You have to be able to go to the same point
in the document every time. A macro is not smart enough to recognize that
for this week or this doc, it must find two spaces instead of one because
someone stuttered on the space bar. If you can exercise any control over
the consistency, things will go much better.
If you do have tables, and these tables are in the same order every time,
with the same data points in the same cells of the same table every time,
it's much easier.
Ed
"joi2" <joi2.1w0z2m_1127837133.5156@xxxxxxxxxxxxxxxxxxxxx> wrote in message
news:joi2.1w0z2m_1127837133.5156@xxxxxxxxxxxxxxxxxxxxxxxx
>
> alright this is pretty much what I have to do I have a project due
> every week i need to sort out a bunch of tables that people send me.
> They pretty much have the same info in each table. but each table is
> broken apart and they are inconsistent. first I'm trying to find a
> macro to link the word file to excel. And second I want to find a way
> to copy the data from a cell in word and pasting it in a cell in excel.
> can someone send me a sample code or something to start off with here is
> what it looks like
> --------------------------------------------------------------------------
-------------------
> *Data Change Type/Application/Platform *
> --------------------------------------------------------------------------
-------------------
> *Type*: Power work, *Platform*: Power System (Data Center),
> *Application*:
> --------------------------------------------------------------------------
-------------------
> *Software/Hardware Status*:
> --------------------------------------------------------------------------
-------------------
> *Impacts IT*: No
> --------------------------------------------------------------------------
-------------------
> for example I want to copy the info after the : which is after
> platform. and paste it in a cell.
>
>
> --
> joi2
> ------------------------------------------------------------------------
> joi2's Profile:
http://www.excelforum.com/member.php?action=getinfo&userid=27554
> View this thread: http://www.excelforum.com/showthread.php?threadid=470764
>
.
- References:
- Re: Getting info from word using macros
- From: joi2
- Re: Getting info from word using macros
- Prev by Date: Re: search 2 spreadsheets and compare a value.
- Next by Date: How can I use a variable as cell address?
- Previous by thread: Re: Getting info from word using macros
- Next by thread: Re: Calling a Sheet
- Index(es):
Relevant Pages
|