rd48sec has asked for the wisdom of the Perl Monks concerning the following question:

Still new to PERL. I have an Excel workbook cell that contains data I want to pass to a PERL script. I want to just push a button in the worksheet that passes the cell value to my PERL script, and run the script. Thank you for any starting point.

Replies are listed 'Best First'.
Re: Excel Button to Run Perl
by pryrt (Abbot) on Feb 17, 2017 at 19:13 UTC

    Associate the button with the pushbutton sub shown:

    Sub pushbutton() arg = Range("A1").Value cmd = "cmd /k perl -le ""print @ARGV"" " & arg Call Shell(cmd) End Sub

    You would, of course, change the address to whichever cell you want, and edit the calling command to refer to your script instead of the commandline-specified script in the -e ""..."". You might need to add quotes around the arg part of the string, depending on what you're passing, and what you're doing in the script.

      Got it to work with a couple changes. Needed to Dim variables and use CStr function. Thanks for the help!
      Sub pushbutton() Dim arg String Dim cmd String arg = CStr(Range("A1").Value) cmd = "cmd /k perl -le ""print @ARGV"" " & arg Call Shell(cmd) End Sub
Re: Excel Button to Run Perl
by huck (Prior) on Feb 17, 2017 at 19:13 UTC
Re: Excel Button to Run Perl
by Anonymous Monk on Feb 17, 2017 at 19:05 UTC
    Perl, not PERL.
      Pörl!

        $ Pörl! -bash: Pörl!: command not found, Charlie