0

I made an executable based on a Python Script that I made from a Selenium Code where I put a number and then it returns a *.pdf file. Now I'm trying to create a VBA Macro in Excel to send the ActiveCell value through the Shell Command to my application:

Sub do_it()
    Dim RetVal As Variant
    RetVal = Shell("C:\Users\ghost\Desktop\assist_exe\dist\assist_inputc.exe " & ActiveCell.Value, 1)
End Sub

The assist_inputc.exe opens up but the ActiveCell's value is not being captured.

  • 1) does it work from a commandline, e.g. `assist_inputc.exe XXX` ... 2) try removing the exe suffix ... 3) replace your exe by the `echo` command to see how your argument is formatted ... 4) try enclosing the program name in single quotes (inside the double) to protect against blanks in Dir names) – MikeD Aug 13 '14 at 07:22

2 Answers2

0

i tried this:

RetVal = Shell("cmd /k C:\Users\ghost\Desktop\assist_exe\dist\assist_inputc.exe ECHO " & ActiveCell.Value, 1)

and still can´t post the value from the ActiveCell into my aplication, but, if i execute the same code without the aplication path it works fine, maybe there´s a diferent way to paste the value?

0

Searching related post´s i find a solution that help me in this problem :

Dim RetVal As Variant
RetVal = Shell("cmd /k C:\Users\ghost\Desktop\temp\dist\assist_empty.exe ", 1)
Application.Wait Now + TimeValue("00:00:01")
SendKeys ActiveCell.Value
SendKeys "{ENTER}"

I hope it works for someone with the same or similar problem.