Consulting

Page 1 of 2 1 2 LastLast
Results 1 to 20 of 37

Thread: Solved: MergeText

  1. #1

    Solved: MergeText

    I mustl merge two files - A main file (containing Bible text excerpts) and an End Notes file (see attached sample files "sample 3 books bible.doc" and "sample end notes.doc"). The following modifications for the end notes file:

    1. Square brackets to be replaced with curly brackets
    2. The end curly bracket to be moved to the end of the paragraph..
    3. Replace << and >> with "
    The supplied workbook, books of the bible.xls, will be used to match and replace book names.

    Standard formatting is required in the reference documents. For example only one paragraph return between lines. Whichever, it must be the same throughout the document.

    Example:
    Bible text:
    Phm 1:2 alla sorella Appia, ad Archippo nostro compagno d' armi e alla comunit? che si raduna nella tua casa,

    End note text (modified):
    {Fm 1,2 alla sorella Appia: varianti: ?sorella diletta?, ?nostra diletta?, ?nostra sorella diletta?.}

    Final text (merged):
    Phm 1:2 alla sorella Appia, ad Archippo nostro compagno d' armi e alla comunit? che si raduna nella tua casa:{Fm 1,2 alla sorella Appia: varianti: ?sorella diletta?, ?nostra diletta?, ?nostra sorella diletta?.}

    Thanks fot attention

  2. #2
    VBAX Wizard
    Joined
    May 2004
    Posts
    6,713
    Location
    Sorry...but what is the question? Are you having a problem with something? You did not ask anything. You "must" merge two files. Yes...and....?????

  3. #3
    Exscuse me for bad English.
    Hallo the problem is:
    I must merge the text of the two files, It is two long file (1-whole bible text) to merge with a long end-notes file, and the end-notes must be put at the end of related bible verse (see example).
    Thanks for attention

    pasquale

  4. #4
    VBAX Expert xCav8r's Avatar
    Joined
    May 2005
    Location
    Minneapolis, MN, USA
    Posts
    912
    Location
    Pasquale, ho capito piu' o menu quello che hai scritto in inglese. Cmq, il fuso orario che hai scelto per il foro mi sembra sbagliato. Dice GMT - 8, il fuso orario di California. Il tuo dovrebbe essere GMT + 1, no?

    Looking at your examples...

  5. #5
    VBAX Expert xCav8r's Avatar
    Joined
    May 2005
    Location
    Minneapolis, MN, USA
    Posts
    912
    Location
    I think I know what he wants to do. Maybe someone can help him with code for the second part of this.

    1. A few find and replaces in "sample end notes.doc." These can be done manually (CTRL+H) and I don't see why they need to be done in VBA. If I'm missing the point, here's something Pasquale can use.

    [VBA]
    Sub ReplaceThisWithThat(strReplaceMe As String, strReplaceWithThis As String)

    Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
    .Text = strReplaceMe
    .Replacement.Text = strReplaceWithThis
    .Forward = True
    .Wrap = wdFindContinue
    .Format = False
    .MatchCase = False
    .MatchWholeWord = False
    .MatchWildcards = False
    .MatchSoundsLike = False
    .MatchAllWordForms = False
    End With
    Selection.Find.Execute Replace:=wdReplaceAll

    End Sub[/VBA]

    2. He wants to loop through each paragraph in the bible excerpts file and conditionally append the corresponding lines from the end notes file to the same paragraph. Conditionally means when it exists. There are not end notes for every line.

    Pasquale, is what I said correct?

  6. #6
    Administrator
    VP-Knowledge Base
    VBAX Guru MOS MASTER's Avatar
    Joined
    Apr 2005
    Location
    Breda, The Netherlands
    Posts
    3,281
    Location
    Quote Originally Posted by xCav8r
    Pasquale, ho capito piu' o menu quello che hai scritto in inglese. Cmq, il fuso orario che hai scelto per il foro mi sembra sbagliato. Dice GMT - 8, il fuso orario di California. Il tuo dovrebbe essere GMT + 1, no?

    Looking at your examples...
    Well Marco aren't we showing of....hidden talent?
    _________
    Groetjes,

    Joost Verdaasdonk
    M.O.S. Master

    Mark your thread solved, when it has been, by hitting the Thread Tools dropdown at the top of the thread.
    (I don't answer questions asked through E-mail or PM's)

  7. #7
    VBAX Expert xCav8r's Avatar
    Joined
    May 2005
    Location
    Minneapolis, MN, USA
    Posts
    912
    Location
    Who me? I was temporarily possessed.

  8. #8
    Administrator
    VP-Knowledge Base
    VBAX Guru MOS MASTER's Avatar
    Joined
    Apr 2005
    Location
    Breda, The Netherlands
    Posts
    3,281
    Location
    Quote Originally Posted by xCav8r
    Who me? I was temporarily possessed.
    Indeed you have that a lot these days!
    _________
    Groetjes,

    Joost Verdaasdonk
    M.O.S. Master

    Mark your thread solved, when it has been, by hitting the Thread Tools dropdown at the top of the thread.
    (I don't answer questions asked through E-mail or PM's)

  9. #9
    VBAX Expert xCav8r's Avatar
    Joined
    May 2005
    Location
    Minneapolis, MN, USA
    Posts
    912
    Location
    Indeed, but why is it always by time zone conscious Italians? I think I've got a question coming on for Babydum.

  10. #10
    Thanks for VBA codes, and for help.
    Yes is the answer at the second question, There are not end notes for every line.

    Grazie - Thanks

    How change "il fuso orario"?

  11. #11
    VBAX Expert xCav8r's Avatar
    Joined
    May 2005
    Location
    Minneapolis, MN, USA
    Posts
    912
    Location
    You can change your time zone by editing your profile. At the top of this page, look for "Quick Links" then select "Edit Options". On the page that comes up, go to the section for Date and Time options. For time zone, choose GMT + 1, then DST (daylight savings time) Correction Option, choose automatically detect. Once that's done, when you see the local time under your name, it should be correct for your local time, and when you mouse over your flag, it should say GMT + 1. Which, if you did it at around the time of this post, should be ~1.30.

    Oh, and welcome to VBAX, Pasquale. You write in English well enough, but if you wanted to write in Italian, that would be okay with me.

    Hopefully a few other people will offer opinions on how best to accomplish this, but I think you might do the merge easier outside of Word using Excel or Access. You can always put it back into Word when you're done, but the advantage of using Excel or Access would allow you to be to parse up the chapter:verse reference, the text of the chapter:verse, and the endnotes for the chapter:verse. Does that make sense?

  12. #12
    Grazie ho cambiato il profilo e il fuso penser? a fare il lavoro con excel.
    Buona notte a tutti
    Good night

  13. #13
    VBAX Mentor Brandtrock's Avatar
    Joined
    Jun 2004
    Location
    Titonka, IA
    Posts
    399
    Location
    Hello Pasquale and welcome to VBAX.

    Foreign Language Forum

    English or Italian is fine here, but our poor other languages forum is feeling lonely.

    Regards,
    Brandtrock




  14. #14
    VBAX Expert xCav8r's Avatar
    Joined
    May 2005
    Location
    Minneapolis, MN, USA
    Posts
    912
    Location
    Actually, I have a bone to pick with the concept of that forum. Think I'll post something multilingual about it.

  15. #15
    VBAX Mentor Brandtrock's Avatar
    Joined
    Jun 2004
    Location
    Titonka, IA
    Posts
    399
    Location
    Better bone up on my other languages then.
    Brandtrock




  16. #16
    Hallo,
    How to move The end curly bracket to the end of the paragraph?

    Is a long test

    thanks I posted the file in excel format in an italian forum for explain better the question

    pasquale

  17. #17
    VBAX Wizard
    Joined
    May 2004
    Posts
    6,713
    Location
    I am not sure what is being asked for here. Move something?

    BTW: here is a more efficient way to replace one string with another. You can test using the =rand command to put in testing text.

    =rand(4,4) - and press Enter will insert 4 paragraphs each containing 4 sentences of "The quick brown fox jumps over the lazy dog." The code below will replace all "brown" text with "green" text.

    [vba]Sub ReplaceThisWithThat(sThis As String, sThat As String)
    Selection.HomeKey unit:=wdStory
    With Selection.Find
    .ClearFormatting
    Do While (.Execute(findtext:=sThis, Forward:=True, _
    Wrap:=wdFindContinue, replacewith:=sThat) = True) _
    = True
    Loop
    End With
    End Sub

    Sub TryReplace()
    ReplaceThisWithThat "brown", "green"
    End Sub[/vba]

  18. #18
    Hallo the problem is this
    My text to modify is:
    {Gen 1:1} Yesterday night ecc
    {Gen 1:2} hallo hallo sub marine ecc

    I want move } at the and of paragraph.
    sample:

    {Gen 1:1 Yesterday night ecc}
    {Gen 1:2 hallo hallo sub marine ecc}

    It is a long long test

    ciao

    pasquale

  19. #19
    VBAX Expert xCav8r's Avatar
    Joined
    May 2005
    Location
    Minneapolis, MN, USA
    Posts
    912
    Location
    Moose, is this easy enough to do with the word objects, or should he move this to excel or access to manipulate these strings? Seems to me it would be more valuable in Access if it were parsed, but that's my opinion. What's yours?

  20. #20
    VBAX Master TonyJollans's Avatar
    Joined
    May 2004
    Location
    Norfolk, England
    Posts
    2,291
    Location
    Hi Pasquale,

    You can move your curly brace using Find and Replace ..

    Check Use Wildcards
    Find Text: \{(*)\}(*)^13
    Replace Text: {\1\2}^13

    Just hit Replace All

    (and record it if you want code)
    Enjoy,
    Tony

    ---------------------------------------------------------------
    Give a man a fish and he'll eat for a day.
    Teach him how to fish and he'll sit in a boat and drink beer all day.

    I'm (slowly) building my own site: www.WordArticles.com

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •