Hi All,

I am completely new to VBA and powershell. I find it hard to understand where to place the double quotes.

I am trying to call a shellscript from vba and it is not working. You can find the code that i tried below.

retval = Shell("powershell -ExecutionPolicy Unrestricted -file "C:\Users\249577\Desktop\New Proj\BMWStage\MigrationFolder.ps1" - Pat """ & Path & """", 1)

Path is a variable(For example it contains a string "D:\Drive") within vba and Pat is the variable in shellscript.

My powershell code is below.

param(
[string]$pat
)
cd "C:\Test"
Get-Content "C:\Test\one.txt" | Foreach-Object {copy-item $_ $pat}

Please help me to resolve this.

Thanks in advance!

Regards,
Yuvi.