Quantcast
Channel: PowerShell.com – PowerShell Scripts, Tips, Forums, and Resources
Viewing all articles
Browse latest Browse all 8583

Call Powershell script from VBA using Shell() function

$
0
0

Hello,

I'm trying to pull a path string variable from the following VBA code into a PS script:

:VBA CODE:

Shell("powershell.exe -ExecutionPolicy Unrestricted -File <pathname>\Convert_To_Tab_Delimited.ps1 -path """& pathVariable &"""",1)

:END OF VBA CODE:

I then have the string variable parameter set as a param in the PS script:

:PS CODE:

param([String]$FileToOpen)

gc $FileToOpen| % { $_ -replace '  +',"`t" } | set-content "<my path>\temp.txt"

:END OF PS CODE:

I am using full paths outside of the path variable.  Does anyone have any ideas?


Viewing all articles
Browse latest Browse all 8583

Trending Articles