View Single Post
  #1   Report Post  
Posted to microsoft.public.excel.programming
Sri via OfficeKB.com Sri via OfficeKB.com is offline
external usenet poster
 
Posts: 20
Default 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