![]() |
#1
|
|||
|
|||
![]()
I have a list of Spanish words followed by a paragraph mark, followed by its translation, followed by another Spanish word and another paragraph mark. I want to delete every paragraph mark that follows a Spanish word or phrase and replace it with a tab and then continue that same process to the end of the file. It's a list of a thousand words. Here's an excerpt:
la televisión[prg mark] television[prg mark] amar[prg mark] to love[prg mark] el/la bebé[prg mark] baby[prg mark] regular[prg mark] regular[prg mark] describir[prg mark] to describe[prg mark] la dieta[prg mark] diet[prg mark] la banda[prg mark] band[prg mark] I want to repeat that delete-and-replace all the way to the end of the file. Anyone have a clue how I can achieve that? I've searched for macros online and 1) they might as well be written in Greek and 2) they never address this particular thing. |
#2
|
|||
|
|||
![]()
I can't think of an easy way to do this entirely in Word, but if you also have Excel:
Open a blank Excel worksheet. Starting in cell A2, type an A, then enter. Type a B in A3, another A in A4, and another B in A5. Then select those ABAB cells and grab the fill handle and fill down to a couple of thousand rows. You'll want those for filtering. Then, copy your text in Word and paste into the Excel sheet starting in cell B2. While it's still copied to your clipboard, ALSO paste it a second time starting in cell C3. You should now have the Spanish entry and the English entry side-by-side. Select the whole area including your A "helper" column with the A's and B's, and activate a filter (Data/Filter). Select "B" in the A column, and those should have the rows that start with the English word and have the next Spanish word next to them. Delete these rows, and clear the filter. Copy the Excel contents (without the A column, as you don't need those "A"s any longer, and paste into Word. It should automatically paste as a table; you can then go to the Layout section of the ribbon and Convert table to text, using a tab as the "separate with" between columns. I'm sure there's a simpler way, but that works. |
#3
|
||||
|
||||
![]()
Is there a specific style or language setting applied to either the spanish or english text so that they are spell checked with the right dictionary? This would be something that we could use to code the macro.
If you post a sample document then we might be able to work out a pattern that could be used for the macro.
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
#4
|
|||
|
|||
![]()
That was brilliant! I can't thank you enough. I never would have thought to create the first column--ABAB--and without it the problem wouldn't have been any easier in Excel than it was in Word. You save me a lot of tedious work.
![]() ![]() ![]() |
#5
|
||||
|
||||
![]()
If the entire document is pairs of spanish/english then I would stay in Word and select it all and convert Text to Table, specify 2 columns and Paragraph mark as the separator.
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
#6
|
||||
|
||||
![]()
And once it is a table it can be converted back to text which puts in the tab marks
__________________
Andrew Lockton Chrysalis Design, Melbourne Australia |
#7
|
|||
|
|||
![]()
Wow, Andrew, I never thought of that! It works more simply than my version.
I've just had to do that in Excel before, and not in Word. See, FMH, I knew there had to be a better way, but also knew my way would work. Now both of us learned something. ![]() |
![]() |
Tags |
delete 2nd occurrence |
Thread Tools | |
Display Modes | |
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
![]() |
Nicknamednick | Word | 9 | 09-28-2022 05:41 PM |
![]() |
eduzs | Word VBA | 7 | 06-27-2020 12:58 PM |
![]() |
nmp13 | Excel | 3 | 02-06-2016 02:13 AM |
How do I delete an Outlook appointment item with VBA? | Joe Patrick | Outlook | 0 | 07-14-2011 06:56 AM |
How to Delete Outlook Item with VBA | Joe Patrick | Outlook | 0 | 07-14-2011 06:49 AM |