<tbody>
[TD="class: votecell"][/TD]
[TD="class: postcell"] I want VBScript to read variable value from VBA as the file directory (<code>Wshell.SendKeys "C:\testfile.txt")</code>will change when I run VBA in loop. I would like to have data as list in Excel and tell VBA to read and then VBScript to paste in Import file window (window displayed by SAP).I know i can run the below script from a separate file and it works. I also read on the net that VBscript can be run inside VBA, however, I can't figure out how to change the code to make it work. I'm not developer, but I learned enough to adjust most of the VBA to my needs. Please assist and advise which command would run the below inside VBA or how to adjust it to work in VBA?
Many thanks in advance.
VBScript:
<code>Set Wshell = CreateObject("WScript.Shell")
MsgBox "in sub"
Do
bWindowFound = Wshell.AppActivate("Import file")
WScript.Sleep 1000
Loop Until bWindowFound
MsgBox "Window = 'Import file' found"
bWindowFound = Wshell.AppActivate("Import file")
If (bWindowFound) Then
Wshell.AppActivate "Import file"
WScript.Sleep 100
Wshell.SendKeys "{tab}"
Wshell.SendKeys "{tab}"
Wshell.SendKeys "{tab}"
Wshell.SendKeys "{tab}"
Wshell.SendKeys "{tab}"
Wshell.SendKeys "C:\testfile.txt"
WScript.Sleep 100
Wshell.SendKeys "{enter}"
WScript.Sleep 100
End If</code>
[/TD]
</tbody>