Running block of Powerhsell Code from VBA

This topic contains 0 replies, has 1 voice, and was last updated by Profile photo of Forums Archives Forums Archives 5 years, 5 months ago.

  • Author
    Posts
  • #6067

    by sgarciacode at 2013-04-02 13:47:10

    Hello Everyone,

    I have a lot of VBA code embedded into Excel and Access tables and I want to integrate in my Powershell code that I have been working on. I know that you can call a powershell file and have it execute, but what I want are the ability to do two things. The first is to be able to call a powershell script that has a function and send it parameters from the VBA script, and the second is to execute a block of powershell code in VBA.

    So for example I want to be able to write something like this in my VBA code:

    call powershell {. "Path to ps1"; myfunction $param1 $param2}

    also

    call powershell { $today = get-date; Write-Host $today}

    Are any of these possible and if so what is the syntax.

    Thanks in advance.

    by DexterPOSH at 2013-04-02 14:23:53

    Hi there,

    I found this link: http://www.tek-tips.com/viewthread.cfm?qid=1585510

    Hope it helps

You must be logged in to reply to this topic.