VBA Script – Passing variable to Powershell as null

Can anyone understand why this value of otp_code variable passes on to powershell as null eventhough if I print it right before passing it it shows correct value?

Public Sub myRuleMacro(item As Outlook.MailItem) otp_code = Right(item.Body, 6) Set objShell = CreateObject(“Wscript.shell”) objShell.Run (“powershell -noprofile -noexit -executionpolicy bypass -file c:copyOtp.ps1 -code” & otp_code) End Sub

submitted by /u/Bimm3rboy
[link] [comments]

Leave a Reply