What I'm trying to do is run a VBA file that opens an excel workbook, starts a macro with an input box, enters text into that input box, presses enter, and then the macro continues to run.
What I have so far is this with "GetData" being the name of the macro:
strPath = "C:\Users\Test\Desktop\ExcelFile.xlsm"
strMacro = "GetData"
Set objApp = CreateObject("Excel.Application")
objApp.Visible = True
Set wbToRun = objApp.Workbooks.Open(strPath)
objApp.Run strMacro
objApp.SendKeys "Sample"
objApp.SendKeys "~"
The problem I'm having is that SendKeys doesn't activate until after the macro is done running. After the Input Box appears, it just stays there until I close it. This results in the macro doing nothing then the word "Sample" being entered into a cell then "Enter" being pressed.
My question is this: how do I get SendKeys to enter values into the Input Box?