#1
|
|||
|
|||
Find word then call signature macro
Hello All, I have a report that has a table at the bottom where it contains the word "Assessed:" (without quotes) followed by a hard return (no space). I am after a macro that will find the word "Assessed:" then move forward once, which would means, due to the hard return, it moves below the word then my signature macro would be called. Intended result shown below Assessed:¿ Dave T Any help appreciated, Dave T |
#2
|
||||
|
||||
You could use something like:
Code:
Sub Demo() Application.ScreenUpdating = False With ActiveDocument.Range With .Find .ClearFormatting .Replacement.ClearFormatting .Text = "Assessed:^l" .Replacement.Text = "" .Forward = True .Wrap = wdFindStop .Format = False .MatchCase = True .MatchWildcards = False .Execute End With If .Find.Found Then .Collapse wdCollapseEnd Call InsertSignatureMacro End If End With Application.ScreenUpdating = True End Sub
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#3
|
|||
|
|||
Hello Paul,
I must be doing something wrong as I have been unable to get this to work. I am currently using Word 2013 and in the attached document I have included your macro and also a macro that Greg Maxey provided for me for another question. I was trying to modify this macro without success before I posted my question on this forum. I had also used the macro recorder and found the word "Assessed:" but must admit I did not even think of using '^1' in my search to move the insertion point so the signature will be below the word "Assessed:". Regards, Dave T |
#4
|
||||
|
||||
The problem with your code is that it uses a Selection object, but the Find macro doesn't change your selection. The simplest fix is to insert:
.Select after: .Collapse wdCollapseEnd
__________________
Cheers, Paul Edstein [Fmr MS MVP - Word] |
#5
|
|||
|
|||
Hello Paul,
Apologies for the delay in replying as I was home madly packing to go to Mount Gambier to go caving and watch my friends go cave diving in Ewens Ponds and Piccaninnie Ponds. Your last suggestion worked well, thank you very much for all of you help. Regards, Dave T |
Thread Tools | |
Display Modes | |
|
Similar Threads | ||||
Thread | Thread Starter | Forum | Replies | Last Post |
Macro to find a word in first row of table and then perform two macros | hmsrose | Word VBA | 5 | 01-30-2015 12:17 AM |
Word 2013: Hotkey to call a macro | arjfca | Word | 2 | 12-04-2014 12:53 AM |
Call Macro from Input Box String | Paulsh | Word VBA | 1 | 11-01-2011 03:15 AM |
Call Excel from Word | donlincolnmsof | Word | 0 | 10-14-2011 05:02 PM |
How do I call/execute an Excel macro from Access 2003 | KramerJ | Excel | 2 | 05-11-2009 11:33 AM |