Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Parsing Word document into Excel

I'll start this off by saying that I've worked with C++, C, Java, and
number of UNIX scripting languages but have little or no knowledge o
VBA. Working with VBA is somewhat essential to the project I'm workin
on at the moment so I came here for help. Just thought I'd present thi
so that any reply includes everything, down to the little details tha
may seem second nature to someone who has experience with VBA. Thanks
and now, onto the question

The company I'm working for needs a program that takes output fro
their Provantis storage system (which gives the most ass-backwards fil
formatting I've ever seen) and put it into an Excel spreadsheet in
usable format. I need help with opening and parsing the Word file
Anything relevant is welcome, but particularly information on settin
delimiters VBA will read between, any functions that get lines o
words, and how to then put any of this into a spreadsheet.

I know it's a lot (or maybe it's very simple and I just dont kno
jack), and my thanks to anyone that take the time to repl

--
Message posted from http://www.ExcelForum.com

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Parsing Word document into Excel

Have you tried selecting the data in Word, copying it to the clipboard, then
going to Excel and select cell A1 on a new sheet and do Edit =Paste. Then
select column 1 and do Data = Text to Columns and walk through the wizard?

You can turn on the macro recorder in Word while you do this manually to get
the word syntax.

Then repeat again with the macro recorder turned on in Excel.



--
Regards,
Tom Ogilvy


"Chill1 " wrote in message
...
I'll start this off by saying that I've worked with C++, C, Java, and a
number of UNIX scripting languages but have little or no knowledge of
VBA. Working with VBA is somewhat essential to the project I'm working
on at the moment so I came here for help. Just thought I'd present this
so that any reply includes everything, down to the little details that
may seem second nature to someone who has experience with VBA. Thanks,
and now, onto the question

The company I'm working for needs a program that takes output from
their Provantis storage system (which gives the most ass-backwards file
formatting I've ever seen) and put it into an Excel spreadsheet in a
usable format. I need help with opening and parsing the Word file.
Anything relevant is welcome, but particularly information on setting
delimiters VBA will read between, any functions that get lines or
words, and how to then put any of this into a spreadsheet.

I know it's a lot (or maybe it's very simple and I just dont know
jack), and my thanks to anyone that take the time to reply


---
Message posted from http://www.ExcelForum.com/



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 220
Default Parsing Word document into Excel

Or, you could use regular expressions to parse the horrible Word format.
You can find information on VBA regular expressions he

http://msdn.microsoft.com/library/de...ting051099.asp


Here is some sample code to get you started:



Private Const FILE_PATH As String = "C:\MyDoc.doc"

Public Sub ImportWordText()
Dim appWord As New Word.Application
Dim strAllText As String
Dim i As Long


With appWord.Documents.Open(FILE_PATH)
strAllText = .Range.Text

Dim re As New VBScript_RegExp_55.RegExp

re.Pattern = "Insert Pattern Here"

With re.Execute(strAllText)
For i = 0 To .Count - 1
With .Item(idxData).SubMatches
For j = 0 To .Count - 1
Debug.Print .Item(j)
Next j
End With
Next idxData
End With

.Close
End With

CleanUp:
appWord.Quit
Set appWord = Nothing
End Sub
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Parsing Word document into Excel

I thought about using the Macro recorder like that, but the Word file'
format is rather unpredictable so I figured whatever macro I recorde
would probably screw up more often than not.


Regular expressions... that almost brings a tear to my eye. That wil
make some of this much easier. Thanks for pushing me in the righ
direction.

Now, can anyone answer my question about how to run an exe (wit
commandline arguments) from VBA

--
Message posted from http://www.ExcelForum.com

  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Parsing Word document into Excel

Use the shell command.
--
Regards,
Tom Ogilvy

"Chill1 " wrote in message
...
I thought about using the Macro recorder like that, but the Word file's
format is rather unpredictable so I figured whatever macro I recorded
would probably screw up more often than not.


Regular expressions... that almost brings a tear to my eye. That will
make some of this much easier. Thanks for pushing me in the right
direction.

Now, can anyone answer my question about how to run an exe (with
commandline arguments) from VBA?


---
Message posted from http://www.ExcelForum.com/





  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 27,285
Default Parsing Word document into Excel

How much variability will there be in terms of the code to copy data from
word?

--
Regards,
Tom Ogilvy

"Chill1 " wrote in message
...
I thought about using the Macro recorder like that, but the Word file's
format is rather unpredictable so I figured whatever macro I recorded
would probably screw up more often than not.


Regular expressions... that almost brings a tear to my eye. That will
make some of this much easier. Thanks for pushing me in the right
direction.

Now, can anyone answer my question about how to run an exe (with
commandline arguments) from VBA?


---
Message posted from http://www.ExcelForum.com/



  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Parsing Word document into Excel

Not sure I understand the question.

I'm writing it all myself and can do it whatever way gets it done

--
Message posted from http://www.ExcelForum.com

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
change excel document into word document mrsb Excel Discussion (Misc queries) 6 August 28th 07 12:58 PM
convert excel document to word document (not a picture) frendabrenda1 Excel Discussion (Misc queries) 2 October 6th 06 03:55 PM
How to change a excel document into a word document? wannaknow Excel Discussion (Misc queries) 1 July 27th 05 09:37 PM
Can you transform an excel document into a word document? Tammy Excel Discussion (Misc queries) 1 May 19th 05 03:23 PM
How do I convert Word document into an Excel document? Jamie Excel Discussion (Misc queries) 3 April 7th 05 09:45 PM


All times are GMT +1. The time now is 09:10 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"