ms word - autohotkey: Run vba macro with ahk script -
#include com.ahk ; com runmswordmacro(correct) { com_init() word := com_getactiveobject("word.application") com_invoke(word, "run", "!"correct) com_release(word) com_term() } ; hotkey 1 1::runmswordmacro("correct") why code not work? @ picture "message", , me please, i'am new user in autohotkey.
when press hotkey, gave me message:
this vba code:
thanks david metcalfe, vba code:
sub correct() ' ' correct macro ' selection.find.clearformatting selection.find.replacement.clearformatting selection.find .text = "p " .forward = true .wrap = wdfindcontinue end selection.find.execute selection.typetext text:="o " end sub
it if explained end goal of code is. based on vba you've provided, seems you're trying run microsoft word, in case use autohotkey entirely.
the run syntax quite simple use.
run, c:\path\to\microsoft word.exe 
Comments
Post a Comment