Shell command from Excel

If you are experiencing problems with "Everything", post here for assistance.
Post Reply
JeroenM
Posts: 2
Joined: Wed Aug 14, 2024 7:22 am

Shell command from Excel

Post by JeroenM »

Hello,

I have an Excel table with several rows of data. On each row is a cell "Drawing", and I want to use Excel VBA to go to Everything and do a search for the contents of this cell "Drawing". The VBA code is below:

TempProgramID = Shell("C:\tmp\Everything\Everything.exe" & " -s " & SearchKey, vbNormalFocus)

SearchKey is the content of the cell "Drawing", but when the cell "Drawing" contains one or more spaces I get an error message in Everything: "Unable to open file list: C:\Windows\System32\4909 is not a valid file list." Where 4909 is a part of the content of cell "Drawing", which is "4022 673 4909".

Is there a way to fix this?

Thanks, JeroenM.
void
Developer
Posts: 16748
Joined: Fri Oct 16, 2009 11:31 pm

Re: Shell command from Excel

Post by void »

Please try:

TempProgramID = Shell("C:\tmp\Everything\Everything.exe" & " -s """ & SearchKey & """", vbNormalFocus)


"" inside quotes = a single literal double quote (")
JeroenM
Posts: 2
Joined: Wed Aug 14, 2024 7:22 am

Re: Shell command from Excel

Post by JeroenM »

Thanks, it works fine now.
Post Reply