Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Getting info from word using macros


I want to know if anyone knows a way to pull certain info from microsoft
word and putting into an excel template or spreadsheet i have a project
due and if anyone knows of a way even to start this off please help.


--
joi2
------------------------------------------------------------------------
joi2's Profile: http://www.excelforum.com/member.php...o&userid=27554
View this thread: http://www.excelforum.com/showthread...hreadid=470764

  #2   Report Post  
Posted to microsoft.public.excel.programming
Ed Ed is offline
external usenet poster
 
Posts: 399
Default Getting info from word using macros

I have done projects in which I have created, opened, saved, and extracted
text from Word documents, all from within Excel VBA macros. If you set a
reference in the VBA Editor (Alt+F11) to the Word library, you will have
access to the Word object model. By setting an object to the Word
application and Word document being used, you can use the Word properties
and methods within an Excel macro to do just about anything.

For more specific help, describe your project with a bit more detail.

Ed

"joi2" wrote in message
...

I want to know if anyone knows a way to pull certain info from microsoft
word and putting into an excel template or spreadsheet i have a project
due and if anyone knows of a way even to start this off please help.



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Getting info from word using macros


I am looking for some help with this i have a word file which has all
the data i need inputed already what i'm trying to do is write a code
that retrieves specific data from the word file like the example below.
such as the date in quotes. and inputs the info in to a cell of a
template or spreadsheet.

(Date Submitted: "9/19/2005" 12:25:10 PM Change Category: Emergency
Change Severity: MEDIUM
Submitter: doe, john (Network NY) Location: Whitestone NY
Submitter Region: NY Metro Impacted Regions: NY Metro
Project Leader: doe, john (Network NY) Director: doe, Jane)


--
joi2
------------------------------------------------------------------------
joi2's Profile: http://www.excelforum.com/member.php...o&userid=27554
View this thread: http://www.excelforum.com/showthread...hreadid=470764

  #4   Report Post  
Posted to microsoft.public.excel.programming
Ed Ed is offline
external usenet poster
 
Posts: 399
Default Getting info from word using macros

joi2:

(Date Submitted: "9/19/2005" 12:25:10 PM Change Category: Emergency
Change Severity: MEDIUM
Submitter: doe, john (Network NY) Location: Whitestone NY
Submitter Region: NY Metro Impacted Regions: NY Metro
Project Leader: doe, john (Network NY) Director: doe, Jane)


How is this data formatted in Word? Is it in a table? Is it in several
lines? All on one line? All data for one line entry in one long paragraph?
Do you just need the data in quotes? Or do you need each separate item,
like:
Date Submitted
Time Submitted
Change Category
Change Severity
Submitter

etc.?

"joi2" wrote in message
...

I am looking for some help with this i have a word file which has all
the data i need inputed already what i'm trying to do is write a code
that retrieves specific data from the word file like the example below.
such as the date in quotes. and inputs the info in to a cell of a
template or spreadsheet.

(Date Submitted: "9/19/2005" 12:25:10 PM Change Category: Emergency
Change Severity: MEDIUM
Submitter: doe, john (Network NY) Location: Whitestone NY
Submitter Region: NY Metro Impacted Regions: NY Metro
Project Leader: doe, john (Network NY) Director: doe, Jane)


--
joi2
------------------------------------------------------------------------
joi2's Profile:

http://www.excelforum.com/member.php...o&userid=27554
View this thread: http://www.excelforum.com/showthread...hreadid=470764



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 162
Default Getting info from word using macros

There are two ways that I've done this - the easy way and the hard way.

The easy way is to create fields in the Word document that you can
iterate through to read/write data. Another easy way is to have all the
data in a table, and navigate the rows and columns.

The hard way is to parse the text. For example you could use Find to
locate the label, then step through the characters following the label
until you come to a line break, another known label, or a punctuation
mark to identity the range of the data to be extracted.

----
Nick Hebb
BreezeTree Software
http://www.breezetree.com



  #6   Report Post  
Posted to microsoft.public.excel.programming
Ed Ed is offline
external usenet poster
 
Posts: 399
Default Getting info from word using macros

I've had to do it the second way, Nick. I had a thousand or more documents
all strung end to end in one long text file, and had to split it all up into
separate doc files, reading each one for data points to populate a
spreadsheet. A major pain! One space different in your Find label, and all
bets were off!

It seemed to me the OP was working with something like I had - a file handed
to you with the instructions, "Get the data into a spreadsheet." If he has
the option of recreating the Word doc, fields or tables are the only way to
go! If this is a regular occurrence (a new doc every week), and there are
several groups of data such as the example he gave, it might not be a bad
idea to create a Word macro to put each data group in a table, and then read
the tables to populate the Excel file.

Cheers!
Ed

"Nick Hebb" wrote in message
ups.com...
There are two ways that I've done this - the easy way and the hard way.

The easy way is to create fields in the Word document that you can
iterate through to read/write data. Another easy way is to have all the
data in a table, and navigate the rows and columns.

The hard way is to parse the text. For example you could use Find to
locate the label, then step through the characters following the label
until you come to a line break, another known label, or a punctuation
mark to identity the range of the data to be extracted.

----
Nick Hebb
BreezeTree Software
http://www.breezetree.com



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Getting info from word using macros


The information are in tables but the tables aren't consistant. fo
example one table can have 5 rows and 10 columns and the next one wil
have 4 rows and 8 columns

--
joi
-----------------------------------------------------------------------
joi2's Profile: http://www.excelforum.com/member.php...fo&userid=2755
View this thread: http://www.excelforum.com/showthread.php?threadid=47076

  #8   Report Post  
Posted to microsoft.public.excel.programming
Ed Ed is offline
external usenet poster
 
Posts: 399
Default Getting info from word using macros

Inconsistent tables can be dealt with - not without a bit of a mess, but
handled nonetheless. The biggest factor you're going to have to deal with
is a consistent "tag" or "label" that can be used to identify your data, and
a consistent data format.

For example, if you have "UserName: John Smith", you can tell your macro to
Find "UserName: ", then select the two words after it. But if the tag can
be UserName, or User, or Name, or usernm, if the number of spaces after
changes or the colon is missing, you might not get it. With this method,
also, if the name is John J. Smith, getting just the two words will give you
only John J., not the Smith.

If it's two table cells, it's even better. For Cell contents = UserName:,
grab contents of next cell (that lets you have John Smith, John J. Smith,
John J. Smith Sr., etc.).

So now you have to decide how consistent everything is, and how much work
you're going to have to do - and are willing to do - to either deal with the
inconsistencies in the document or write code for every possibility. If you
have any control over how this document is formatted before it's given to
you - that is, how consistent it is when put together - then you can make
life easier. Time spent here is time well spent! And more productive than
searching page after page of your report looking for the glitches your code
snatched out of a jumbled data document!

Ed

"joi2" wrote in message
...

The information are in tables but the tables aren't consistant. for
example one table can have 5 rows and 10 columns and the next one will
have 4 rows and 8 columns.


--
joi2
------------------------------------------------------------------------
joi2's Profile:

http://www.excelforum.com/member.php...o&userid=27554
View this thread: http://www.excelforum.com/showthread...hreadid=470764



  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Getting info from word using macros


alright this is pretty much what I have to do I have a project du
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 i
broken apart and they are inconsistent. first I'm trying to find
macro to link the word file to excel. And second I want to find a wa
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 i
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 afte
platform. and paste it in a cell

--
joi
-----------------------------------------------------------------------
joi2's Profile: http://www.excelforum.com/member.php...fo&userid=2755
View this thread: http://www.excelforum.com/showthread.php?threadid=47076

  #10   Report Post  
Posted to microsoft.public.excel.programming
Ed Ed is offline
external usenet poster
 
Posts: 399
Default Getting info from word using macros

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" wrote in message
...

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...o&userid=27554
View this thread: http://www.excelforum.com/showthread...hreadid=470764



Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Macros pulling info from other worksheets [email protected] Excel Worksheet Functions 3 December 7th 07 10:01 AM
Excel Word copying info from Excel to Word without gridlines / bor Renee Thomas Excel Discussion (Misc queries) 2 September 13th 07 09:24 AM
Hi im new to Excel and need info on Macros! SarahKay New Users to Excel 1 June 15th 05 02:43 PM
Making excel macros run Word macros Matthew McManus Excel Programming 1 February 18th 04 02:57 AM
Database info in Word doc Debra Dalgleish[_2_] Excel Programming 0 September 3rd 03 09:20 PM


All times are GMT +1. The time now is 07:11 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"