Hi,
Does anyone know how to add an action to add text to a pre defined position in a MS Word Document? I would like to copy a reference into two places within a word template if possible please.
Thanks
Hi,
Does anyone know how to add an action to add text to a pre defined position in a MS Word Document? I would like to copy a reference into two places within a word template if possible please.
Thanks
This came up semi recently, here:
That's a link to @Nige_S' post with an AppleScript that will work for what you want to do, I think.
It does have one requirement, though: You need to have placeholders in the text where you want the replacement text to go. In the Word template, insert ##MARKER##
or whatever, then your Keyboard Maestro Execute AppleScript command might look something like this:
set inst to system attribute "KMINSTANCE"
tell application "Keyboard Maestro Engine"
set theNewText to getvariable "local_NewText" instance inst
end tell
tell application "Microsoft Word"
set myRange to text object of active document
execute find (find object of myRange) find text "##MARKER##" replace with theNewText replace replace all
end tell
You'd need to have the macro set a value for local_NewText
before the Execute AppleScript action.
If this isn't what you're trying to do, can you give a more-detailed explanation?
-rob.
Hi Rob,
Thanks this is works perfectly - sorry for the delay only just got around to looking at this properly
No problem with a delay in replying, and glad it worked for you—full credit to @Nige_S; I just remembered it being posted :).
-rob.
Top job both of you. Will use this daily so easily save me a bunch of time and typos.
Thank you