![]() |
![]() |
![]() |
|||||
![]() |
![]() |
![]() |
![]() |
![]() |
|||
| Welcome
to Tech Support Forum home to more then 136,000 problems solved. Issues
have included: Spyware, Malware, Virus Issues, Windows, Microsoft,
Linux, Networking, Security, Hardware, and Gaming Getting your
problem solved is as easy as: 1. Registering for a free account 2. Asking your question 3. Receiving an answer Registered members: * See fewer ads. * And much more..
|
| Want to know how to post a question? click here | Having problems with spyware and pop-ups? First Steps |
|
|||||||
| Microsoft Office support MS Office support forum |
![]() |
|
|
LinkBack | Thread Tools |
|
|
#1 (permalink) |
|
Registered User
Join Date: Mar 2009
Posts: 3
OS: Windows XP
|
Hi everyone,
I am working on several Word documents which look like so. Here is how each block of text is arranged: Numbers tab Numbers Paragraph Text Paragraph Text Paragraph Paragraph I would like to import this data into Excel to make it look like this. First column: first series of numbers Second column: second series of numbers Third column: First line of text(alt+return)Second line of text I hope all of this is clear. I have tried creating a macro on my own, but I don't know Visual Basic, so I have failed miserably. I need to do this on 40 documents which contain up to 100 blocks of text. Any help would be appreciated! Thanks a lot. Last edited by pwyf; 03-05-2009 at 01:21 AM. |
|
|
|
| Important Information |
|
Join the #1 Tech Support Forum Today - It's Totally Free!
TechSupportForum.com is a leading support website for your computer needs. We offer free, friendly and personalized computer support. Why pay to have your computer fixed when you can do it for free. Join TechSupportforum.com Today - Click Here |
|
|
#2 (permalink) |
|
TSF Enthusiast
Join Date: Apr 2008
Location: Australia
Posts: 559
OS: Vista
|
Re: Macro to import text from Word to Excel
Hi pwyf
Does the 1st paragraph everhave more than the two times and a single tab separating them? Do the other paragraphs have tabs or commas in them?
__________________
Cheers macropod (MS MVP -Word) |
|
|
|
|
|
#4 (permalink) |
|
TSF Enthusiast
Join Date: Apr 2008
Location: Australia
Posts: 559
OS: Vista
|
Re: Macro to import text from Word to Excel
Hi pwyf,
Here's some code that takes the active document and converts its contents to a tab-delimited format suitable for exporting to Excel: Code:
Sub MakeTabDelimitedText()
Dim EndRng As Range
With ActiveDocument
.Paragraphs(1).Range.Text = Replace(.Paragraphs(1).Range.Text, vbCr, vbTab)
With .Content.Find
.ClearFormatting
.Replacement.ClearFormatting
.Text = "^p"
.Replacement.Text = Chr(10)
.Forward = True
.Wrap = wdFindContinue
.Format = False
.MatchCase = False
.MatchWholeWord = False
.MatchWildcards = False
.MatchSoundsLike = False
.MatchAllWordForms = False
.Execute Replace:=wdReplaceAll
End With
Set EndRng = .Range.Characters.Last
With EndRng
.MoveStart wdCharacter, -1
.Delete
End With
End With
End Sub
__________________
Cheers macropod (MS MVP -Word) |
|
|
|
![]() |
| Thread Tools | |
|
|