Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 03-22-2016, 07:11 PM
Dave T Dave T is offline Find word then call signature macro Windows 7 64bit Find word then call signature macro Office 2007
Advanced Beginner
Find word then call signature macro
 
Join Date: Nov 2014
Location: Australia
Posts: 60
Dave T is on a distinguished road
Default 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
Reply With Quote
  #2  
Old 03-22-2016, 08:25 PM
macropod's Avatar
macropod macropod is offline Find word then call signature macro Windows 7 64bit Find word then call signature macro Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,225
macropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant future
Default

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]
Reply With Quote
  #3  
Old 03-23-2016, 06:19 PM
Dave T Dave T is offline Find word then call signature macro Windows 7 64bit Find word then call signature macro Office 2007
Advanced Beginner
Find word then call signature macro
 
Join Date: Nov 2014
Location: Australia
Posts: 60
Dave T is on a distinguished road
Default

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
Attached Files
File Type: docm Find then insert signature.docm (18.0 KB, 2 views)
Reply With Quote
  #4  
Old 03-23-2016, 07:57 PM
macropod's Avatar
macropod macropod is offline Find word then call signature macro Windows 7 64bit Find word then call signature macro Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,225
macropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant futuremacropod has a brilliant future
Default

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]
Reply With Quote
  #5  
Old 03-28-2016, 11:18 PM
Dave T Dave T is offline Find word then call signature macro Windows 7 64bit Find word then call signature macro Office 2007
Advanced Beginner
Find word then call signature macro
 
Join Date: Nov 2014
Location: Australia
Posts: 60
Dave T is on a distinguished road
Default

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
Reply With Quote
Reply

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
Find word then call signature macro Word 2013: Hotkey to call a macro arjfca Word 2 12-04-2014 12:53 AM
Find word then call signature macro 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
Find word then call signature macro How do I call/execute an Excel macro from Access 2003 KramerJ Excel 2 05-11-2009 11:33 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 01:18 PM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2021, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2021 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft