#1
|
|||
|
|||
Please help! Macros not recorded as expected
Hi!
I am totally novice in macros and VBA. I want to create a macro that will operate about 30 find/replace steps. The first find/replace I need to do consist in replacing a non printable (#0D) character which first occurrence is always located at the same position in the file. All other find/replace steps So I decided to create a macro using the "Record macro..." command. But almost no step I operate is recorded. For instance, after a succession of about 30 "find/replace" steps, I only get this in the macro: Sub Macro1() ' ' Macro1 Macro ' ' Selection.Copy End Sub Some times I only get the last Find/Replace step I tried several times, but only oner step is recorded in the macro (and not always the same step!!!) So, I have a few questions: 1. Is it normal that actions I did after I started recording the macro are not recorded? (for instance: the action of selecting a certain character at a certain location in the file, or all Replace actions I did...) 2. Is it possible to add a VBA step that will automatically select a character that is always located at the same place in the file? 3. How can I perform a Find/Replace step that finds all occurrences of #0D character and replaces them by something else? (i.e. paragraph break + "&&&" sequence) Many thanks in advance Last edited by Chibiberu; 03-30-2019 at 12:19 AM. |
#2
|
||||
|
||||
Hi and welcome
using a descriptive title will almost certainly attract more help. Please change it ( click Go advanced to edit)
__________________
Did you know you can thank someone who helped you? Click on the tiny scale in the right upper hand corner of your helper's post |
#3
|
||||
|
||||
There is a lot the macro recorder won't record, but Find/Replace actions isn't one of them.
To see how you can combine multiple Find/Replace actions in a single macro, check out https://www.msofficeforums.com/word/...s-e-mails.html As for the '#0D character', I assume you mean the ASCII 13 character, which Word displays as ¶. That can be found via Find = ^13.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#4
|
|||
|
|||
macropod,
Thank you for the information. I didn't know I could find a character by its ASCII code (^13) Knowing that, I just need a series of Replace steps in the macro. I could have one recorded in the macro. So, I duplicated this step in the macro and changed each Replace command with the right characters to find and replace. It worked! By the way, ASCII 13 character is not interpreted as paragraph break on MacOS. I just get a small square displayed Paragraph marks are found when I search for ^10 characters. I guess this is because I am working on MacOS, not Windows (I know, my public profile still shows "Windows7" although I changed it with "MacOS") Anyway, you "saved my life". Many thanks! |
#5
|
||||
|
||||
In Word, paragraph breaks consist of an 0D 0A pair (ASCII 13 & 10). ASCII 13 on its own, though it might appear like a paragraph break, isn't one - though it sufficies when using a wildcard Find. If you want to do a Find for paragraph breaks when not using wildcards, use Find = ^p.
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Modify recorded macro to run until end of document | peter961 | Word VBA | 1 | 09-04-2017 02:50 PM |
Embedded Video Not Playing in Recorded Presentation | bhadden1 | PowerPoint | 0 | 08-16-2017 03:07 PM |
Add previously recorded sound and synchronize with slide annimations | daniellouw | PowerPoint | 1 | 03-03-2017 11:14 AM |
Can I record more to add on to a recorded Macro? | Clueless in Seattle | Word VBA | 3 | 05-25-2015 01:21 AM |
Recorded audio (record slide show) won't play in older versions | Landy | PowerPoint | 0 | 03-03-2012 03:14 PM |