I am using Excel VBA to run a simple Powershell script that, when run in Powershell itself, returns one or two file names of some files within a given directory.
I can run this script from my VBA, but the return value is always some random integer. How do I get the script to return the file names that were returned through the Powershell script?
VBA to call script:
Dim weekly As String weekly = Shell("Powershell ""<location of powershell script.ps1>""")
Script:
Get-ChildItem "<directory to search in>" | Where-Object {$_.Name -match "<regex to find file name>"}
If I have missed any details, please ask.