Hi @Rajesh Kulanthaivelu ,
I'm assuming that you want to perform Word Automation, but since we don't have a scope currently for Word to run macros with, you want to trigger them from Excel.
I've written something similar to this yesterday, and you can check it out if you are interested.
This can be done, but I would recommend keeping the Word non-macro enabled. Macro enabled word files don't communicate properly with Excel for some reason, and you will run into several issues when trying to trigger macros build in word, from Excel.
Here is an example of a macro built in excel which gets the job done on word:
Sub automateword()
Dim wdObj As Object, wdDoc As Object
Dim filePath As String
filePath = File Path Goes Here
Set wdObj = CreateObject("word.Application")
wdObj.Visible = True
wdObj.Documents.Open filePath, ReadOnly:=False
'Word Automation goes here
wdObj.Selection.TypeText Text:="Hello World!"
End Sub
Kind Regards,
Ashwin A.K
Thanks Ashwin. I will explore this option. Is there are any other option to trigger a word macro from AA? Like I read in one of the forums to create a hotkey shortcut for the word macro and then trigger it using keystrokes. Would you suggest if there is any challenge in using this approach or share alternate approaches, if any
Hi @Rajesh Kulanthaivelu
You could probably turn that into a working solution, but the bot will wait for something to trigger it, whether it be file creation, deletion, or keystrokes i.e., something external to activate it.
The bot can't trigger itself i.e,, adding a keystroke after the bot starts listening for a trigger won't do the trick.
They way I see it, it looks like a lot of complexity, but there is no harm in exploring those options as well.
Kind Regards,
Ashwin A.K
Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.