Running block of Powerhsell Code from VBA

Welcome Forums General PowerShell Q&A Running block of Powerhsell Code from VBA

This topic contains 0 replies, has 1 voice, and was last updated by  Forums Archives 7 years ago.

  • Author
  • #6067

    Points: 0
    Rank: Member

    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}


    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:

    Hope it helps

The topic ‘Running block of Powerhsell Code from VBA’ is closed to new replies.