#1
|
|||
|
|||
Help with macro
Hello,
I need help creating macro that will strip the document of a series of tags and replace it with new tags. See attached document. The tag that I need to strip out is highlighted in yellow and the new tags are in a separate document. I have a series of document and I just want to check if there is an easier way than just copying and pasting. Thanks. Any feedback will be greatly appreciated! Many thanks in advance! |
#2
|
|||
|
|||
tingker, It looks like you want someone to write your macro for you. "I need help ..." implies you have tried and failed.
I'll give you some code to get you started: Code:
Sub ScratchMacro() 'A basic Word macro coded by Greg Maxey Dim arrNums() As String Dim lngIndex As Long arrNums = Split("QHBB19VKSPW0NRLPU792|MRQFVW0WXN400MH9D416|JHURQ0VND7Q45PUBN011|RACAAYRWYBX840BJU005|" _ & "PYZL7DR3NME4N5LEB490|CFWSPWA9MA96RS75K298|RYRXH35AK3BHFUGZN987|NPQVJ33EUY66QC0TD738|" _ & "VLDTH09A33AKJ70NJ153|XWXWU30WZACA7CEBQ776|GTST08D3XR52JCCCE566|TVLCRCUPE6ELKC0U4018|" _ & "TRYXRUWC3K2GA7249398|JKSG4XX7B4609ZB5K909|CYNFF3LERUXF2S9KS589|AZGRNTJC2HLJCJH4K507|" _ & "JBPUKJ2JDYHN24R23272|VJPGVMP2JXX8J12EZ883|BUFQK2RMQHMQ5A4JF577|NQDTZ9DLLE8STZSN9996|" _ & "QUZE112HEU5Q8AE5S194|HMXZQ7WTRNY2KSLBF035", "|") Dim oRng As Word.Range lngIndex = 0 Set oRng = ActiveDocument.Range With oRng.Find .Highlight = True While .Execute oRng.Text = arrNums(lngIndex) oRng.Collapse wdCollapseEnd lngIndex = lngIndex + 1 Wend End With End Sub Last edited by gmaxey; 03-05-2015 at 08:38 AM. |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Macro Question: Need help making a macro to highlight the first word in every sentence | LadyAna | Word | 1 | 12-06-2014 10:39 PM |
Macro Needed to bold specific lines and Macro to turn into CSV | anewteacher | Word VBA | 1 | 05-28-2014 03:59 PM |
custom icon, undo/redo for macro, permanent macro | Rapier | Excel | 0 | 08-05-2013 06:30 AM |
How do I assign a macro to a button when the macro is in my personal workbook? | foolios | Excel Programming | 2 | 07-27-2011 02:41 PM |