Is there a software or tool that can quickly convert VBS code into PowerShell code?
In addition, I want to know, the following With
statement in the VBS cod
PowerShell doesn't have an equivalent for VBScript's With
statement. Instead of
With wrdApp.Selection.Find
.ClearFormatting
.Replacement.ClearFormatting
...
End With
you'd probably do something like this:
$find = $wrdApp.Selection.Find
$find.ClearFormatting()
$find.Replacement.ClearFormatting()
...
or like this:
$wrdApp.Selection.Find | ForEach-Object {
$_.ClearFormatting()
$_.Replacement.ClearFormatting()
...
}
Also, to my knowledge there is no VBScript or VBA to PowerShell compiler. I put together some notes on how to translate VBA code to PowerShell, though.