0

How to handle prompts generated when running the macros using the below code?

import win32com.client
import time

xl=win32com.client.Dispatch('Excel.Application')
xl.Visible = 1
xl.DisplayAlerts = False
xl.Workbooks.Open(Filename=r'FilaName.xlsm')
xl.Application.Run('r'FilaName.xlsm!MacrosName.MacrosName')
xl.Application.Quit()
del xl

The process opens a prompt and waits for manual input. How do we automate this thing?

I have few ideas like using the Threads, but it seems to be a long shot. Any simpler ideas?

Charlie Clark
  • 18,477
  • 4
  • 49
  • 55
Aditya
  • 90
  • 1
  • 8
  • 1
    Is the manual input known before hand? You could add arguments to the macro, a boolean for whether run externally and then another for the manual input? – Nathan_Sav Aug 23 '21 at 14:50
  • Yes, the manual input is known, or sometimes clicking a button would do the work. Change in macros is also a good option, but I was looking for a more programmatical way to send input or press a button on the prompt. – Aditya Aug 23 '21 at 17:39

0 Answers0