![]() |
Invoking "cmd" from VB macro
Hello all,
I want to execute following dos command in my XL VB macro. dir C:\Project\Test_Cases /s C:\TEMP_TEST_CASE_ROOT_XXX\files.txt If C:\Project\Test_Cases will be in a variable FName then the following command is perfectly working fine for me. x = Shell("cmd.exe /c dir " & FName & " /s C:\TEMP_TEST_CASE_ROOT_XXX\files. txt", vbHide) The problem comes if my FName has a space in it. For example, if FName is C:\ Project\Test Cases then the above command is not working. How to append " symbol as prefix and suffix to my variable FName. Any help please ??? Sri -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...mming/200811/1 |
Invoking "cmd" from VB macro
FName = """c:\ the path"""
or FName = chr(34) & "c:\ the path" & chr(34) Regards, Peter T "Sri via OfficeKB.com" <u47062@uwe wrote in message news:8d0950ab3f660@uwe... Hello all, I want to execute following dos command in my XL VB macro. dir C:\Project\Test_Cases /s C:\TEMP_TEST_CASE_ROOT_XXX\files.txt If C:\Project\Test_Cases will be in a variable FName then the following command is perfectly working fine for me. x = Shell("cmd.exe /c dir " & FName & " /s C:\TEMP_TEST_CASE_ROOT_XXX\files. txt", vbHide) The problem comes if my FName has a space in it. For example, if FName is C:\ Project\Test Cases then the above command is not working. How to append " symbol as prefix and suffix to my variable FName. Any help please ??? Sri -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...mming/200811/1 |
Invoking "cmd" from VB macro
Thank you very much Peter. It works fine for me...
Sri Peter T wrote: FName = """c:\ the path""" or FName = chr(34) & "c:\ the path" & chr(34) Regards, Peter T Hello all, [quoted text clipped - 17 lines] Sri -- Message posted via OfficeKB.com http://www.officekb.com/Uwe/Forums.a...mming/200811/1 |
All times are GMT +1. The time now is 05:05 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com