the Code in question is this and I am using this to Zip all files in a specified path using PowerShell and the path is given in a cell of a excel workbook.
Sub Button30_Click() Dim retval Dim a As String Dim b As String a = ThisWorkbook.Sheets(“INPUT TAB”).Range(“B79”).Value ‘getting the source path b = ThisWorkbook.Sheets(“INPUT TAB”).Range(“B79”).Value ‘getting the destination path retval = Shell(“Powershell “”Compress-Archive -Path ” & a & ” -CompressionLevel Optimal -DestinationPath ” & b) End Sub
The actual powershell script is
Compress-Archive -LiteralPath C:TestingDemo -CompressionLevel Optimal -DestinationPath C:TestingDraft.Zip
Please help me fix this so that the vba takes the path from a cell of excel and use it to run the PS script.