+ Reply to Thread
Results 1 to 7 of 7

WORD -Out-of-date norms - Can you make a macro for searching and replacing for up-to-date?

  1. #1
    Registered User
    Join Date
    05-11-2015
    Location
    Brno, Czech Republic
    MS-Off Ver
    Word 2013
    Posts
    20

    WORD -Out-of-date norms - Can you make a macro for searching and replacing for up-to-date?

    Hi,

    I have a task at my work in Word which I repeat very often and it would really make my life easier if I had a macro for it. Unfortunately I am noob in this, but willing to learn.. Thanks for any answer guys
    So my question is: Is it possible to make a macro for this??:

    I have two documents (two Word windows):
    DOCUMENT(1) – text of my work in which are some technical norms which are out-of-date.
    DOCUMENT(2) - list of up-to-date technical norms

    Obviously what I want is to have these out-of-date technical norms in DOCUMENT(1) replaced with up-to-date technical norms; or simply make them red if they are older, different...

    In atachements I send two document examples, which can make you understand better. Thanks for any answer Document(2).docxDocument(1).docx

  2. #2
    Registered User
    Join Date
    05-11-2015
    Location
    Brno, Czech Republic
    MS-Off Ver
    Word 2013
    Posts
    20

    Re: WORD -Out-of-date norms - Can you make a macro for searching and replacing for up-to-d

    I have tryed this but it´s not working properly..

    Sub Makro1()

    Selection.Copy
    Windows("Dokument2.docx").Activate
    Selection.Find.ClearFormatting
    Selection.Find.Replacement.ClearFormatting
    With Selection.Find
    .Text = Selection

    End With
    Selection.Find.Execute
    Selection.MoveEndUntil (Cset = "(")
    Selection.Copy
    Windows("Dokument1.docx").Activate
    Selection.PasteAndFormat (wdFormatOriginalFormatting)
    End Sub
    Last edited by Cubajz; 05-22-2015 at 12:26 PM.

  3. #3
    Forum Expert macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,726

    Re: WORD -Out-of-date norms - Can you make a macro for searching and replacing for up-to-d

    For an example that uses an Excel workbook to hold the Find/Replace strings and uses a Word macro to process all files in whatever folder you point it to, see: http://www.msofficeforums.com/word-v...html#post34254
    Cheers,
    Paul Edstein
    [Fmr MS MVP - Word]

  4. #4
    Registered User
    Join Date
    05-11-2015
    Location
    Brno, Czech Republic
    MS-Off Ver
    Word 2013
    Posts
    20

    Re: WORD -Out-of-date norms - Can you make a macro for searching and replacing for up-to-d

    Hi, thank you for your answer but I think this is not solving my problem - it is because i have only up to date norms in my Catalog, and there are many other older possibilities of those norms - and those are not listed in my Catalog but they can be found in my work documents...

    For me I think the only solution is to design special conditions for finding these norms in document and than again finding and then replacing their equivalents from up-to-date Catalog- I have already made up these conditions to find- and select- the proper text string, now I am asking for help to do the rest of the programing because I am really beginner in that...I ll try to write these finding conditions here as soon as possible, so that you can maybe help me better. And thanks for your help, I really appreciate it a lot

  5. #5
    Forum Expert macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,726

    Re: WORD -Out-of-date norms - Can you make a macro for searching and replacing for up-to-d

    Unless you know both the out-dated and current terms, no programmatic Find/Replace process is going to help. You need to know both but here, it seems, you don't know what you'll want to find... Of course, if you add the out-dated terms and their current equivalents to the workbook as you find them, you can use the macro in the link. As it stands, even your document 2 (list of up-to-date technical norms) can't be used for a Find/Replace because it wouldn't be apparent to any macro which of your highlighted terms is to be used to replace a given out-dated one in your document 1.

  6. #6
    Registered User
    Join Date
    05-11-2015
    Location
    Brno, Czech Republic
    MS-Off Ver
    Word 2013
    Posts
    20

    Re: WORD -Out-of-date norms - Can you make a macro for searching and replacing for up-to-d

    Is there any way to make a skript which would automaticly find specific text string and then replace it with "almost" similar equivalent found in my Catalog? I personaly think the character "/" and string ":[YEAR]" could be the key to programming some "search engine" for this specific issue and solving the whole problem in a way, that I could let my computer do the work for few minutes/hours and do other important thing in the meantime ...

    The argument is this: Because technical norms always ends with year (for example ČSN EN ISO 12100:2011) , there is always something like this ":2011" at the end of string
    Character "/" is the one which either is or is not immidiately after this ":2011" - that is how the script will now if:
    - the norm is the same (meaning there is not character "/" after ":2011" ) - norm is up to date - job done
    - the norm is different (meaning there is character "/" after ":2011" ) - must continue the selection until there is character "/" immidiately after ":2011" and replace the old norm in document.


    I think it is quite confusing how I wrote it But if you just simply think about importance of character "/" and ":[YEAR]" for a second you can than understand the logic as well I think...I am able to understand this logic (I can write it to the details if you would like to) but I am absolutely unable to do the scripting, so again, I am asking for your help. Thanks again for any answer, you already suprised me with the first macro!

  7. #7
    Forum Expert macropod's Avatar
    Join Date
    12-22-2011
    Location
    Canberra, Australia
    MS-Off Ver
    Word, Excel & Powerpoint 2003 & 2010
    Posts
    3,726

    Re: WORD -Out-of-date norms - Can you make a macro for searching and replacing for up-to-d

    Quote Originally Posted by Cubajz View Post
    Is there any way to make a skript which would automaticly find specific text string and then replace it with "almost" similar equivalent found in my Catalog?
    No. A Find/Replace has to work with a known Replace string - it can't look somewhere for something "with "almost" similar equivalent". Although one can use wildcards to Find something that conforms to a pattern, the Replace expression needs to be something specific.

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Searching for next largest date value based on current date.
    By RockstarAgent in forum Excel General
    Replies: 2
    Last Post: 05-30-2014, 04:17 PM
  2. removing date from entry and replacing with word
    By H_Kennedy in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-12-2014, 03:41 AM
  3. [SOLVED] removing date from entry and replacing with word
    By H_Kennedy in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 01-10-2014, 07:53 PM
  4. Searching for a date in date ranges and more
    By cureless in forum Excel Formulas & Functions
    Replies: 2
    Last Post: 10-02-2012, 11:09 PM
  5. Make a Trial Date Macro ?
    By harryben in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 08-12-2005, 12:05 PM

Bookmarks

Posting Permissions

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

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1