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

I am using the programming below but can't get it to work on this type of
address:
Herrn
Guido Aulbach
Assessor jur.
Zürich Gruppe
Solmsstrasse 27-37
D-60252 Frankfurt am Main

Herrn
Ralph Brand
Senior Vice President
AIG Europe
Tour AIG
92079 Paris La Défense
2 Cedex
France

Sub ParseData()
'
' WORDTOEXCEL Macro
' Macro recorded 09/12/2007 by Adam Kelly
'

'
Dim r As Range, r1 As Range
Dim r2 As Range, rw As Long
Dim cell As Range, c As Range
Dim rng As Range
Dim i As Long, j As Long
Dim s As String, s1 As String
Dim s2 As String, s3 As String
Dim ipos1 As Long, ipos2 As Long
rw = 2
Set rng = Columns(1).SpecialCells(xlBlanks)
For Each cell In rng.Areas
Set r = cell(cell.Count).Offset(1, 0)
Set r1 = r.End(xlDown)
Set r2 = Range(r, r1)
j = 0
If r2.Rows.Count 7 Then Exit Sub
For Each c In r2
j = j + 1
Cells(rw, 3 + j) = c.Value
Next
Cells(rw, 3 + 1) = Trim(Replace _
(Cells(rw, 3 + 1), "", ""))
s = Cells(rw, 3 + j)
ipos1 = InStr(1, s, " ", vbTextCompare)
ipos2 = InStrRev(s, " ", -1, vbTextCompare)
s1 = Trim(Left(s, ipos1 - 1))
s2 = Trim(Mid(s, ipos1 + 1, ipos2 - ipos1))
s3 = Mid(s, ipos2 + 1, 255)
Cells(rw, 3 + j) = s1
Cells(rw, 3 + j + 1) = s2
Cells(rw, 3 + j + 2) = s3
rw = rw + 1
Next cell
End Sub

Can you tell me what is wrong with the language. Need to merge from word to
excel spreadsheet in order to import into database.
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,836
Default word to excel

I've tried these resources with some great success:
http://gregmaxey.mvps.org/Extract_Form_Data.htm
http://word.mvps.org/faqs/interdev/c...xlfromword.htm
http://word.mvps.org/FAQs/InterDev/C...XLFromWord.htm

Regards,
Ryan---


--
RyGuy


"gwbdirect" wrote:

I am using the programming below but can't get it to work on this type of
address:
Herrn
Guido Aulbach
Assessor jur.
Zürich Gruppe
Solmsstrasse 27-37
D-60252 Frankfurt am Main

Herrn
Ralph Brand
Senior Vice President
AIG Europe
Tour AIG
92079 Paris La Défense
2 Cedex
France

Sub ParseData()
'
' WORDTOEXCEL Macro
' Macro recorded 09/12/2007 by Adam Kelly
'

'
Dim r As Range, r1 As Range
Dim r2 As Range, rw As Long
Dim cell As Range, c As Range
Dim rng As Range
Dim i As Long, j As Long
Dim s As String, s1 As String
Dim s2 As String, s3 As String
Dim ipos1 As Long, ipos2 As Long
rw = 2
Set rng = Columns(1).SpecialCells(xlBlanks)
For Each cell In rng.Areas
Set r = cell(cell.Count).Offset(1, 0)
Set r1 = r.End(xlDown)
Set r2 = Range(r, r1)
j = 0
If r2.Rows.Count 7 Then Exit Sub
For Each c In r2
j = j + 1
Cells(rw, 3 + j) = c.Value
Next
Cells(rw, 3 + 1) = Trim(Replace _
(Cells(rw, 3 + 1), "", ""))
s = Cells(rw, 3 + j)
ipos1 = InStr(1, s, " ", vbTextCompare)
ipos2 = InStrRev(s, " ", -1, vbTextCompare)
s1 = Trim(Left(s, ipos1 - 1))
s2 = Trim(Mid(s, ipos1 + 1, ipos2 - ipos1))
s3 = Mid(s, ipos2 + 1, 255)
Cells(rw, 3 + j) = s1
Cells(rw, 3 + j + 1) = s2
Cells(rw, 3 + j + 2) = s3
rw = rw + 1
Next cell
End Sub

Can you tell me what is wrong with the language. Need to merge from word to
excel spreadsheet in order to import into database.

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
Need Excel count of 1 word if found in multi-word cells of column Function_Challenged Excel Worksheet Functions 1 August 27th 09 12:08 AM
Excel to run Word macro & Word returns value to be written in spreadsheet KS[_2_] Excel Programming 0 November 28th 06 05:33 PM
Import cells from excel into word and create multiple word docs scdaddy7269 Excel Programming 2 March 20th 06 07:03 PM
Print labels by using Excel data in a Word mail into word Zoey Excel Discussion (Misc queries) 1 November 1st 05 09:08 PM
Printing Word Document using Excel Programming hangs Word Alan Excel Programming 0 September 30th 04 08:41 PM


All times are GMT +1. The time now is 08:07 AM.

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

About Us

"It's about Microsoft Excel"