Click here to Skip to main content
15,886,578 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have a program that automatically opens a RTF file.
This is my code
VB
Shell "C:\Program Files\Windows NT\Accessories\wordpad.exe " & rtfPath, vbNormalFocus

When the line is executed the Wordpad opens but I'm getting this error in Wordpad
C:\RTF Cannot find this file. Please verify that the correct file name are given.

Well the actual path is this C:\RTF Files\000001.rtf and I think the problem is the space. Is there a way to open the file even the file path has space.

Thanks
Posted

1 solution

You may need to put the path string in double quotes to get it accepted. I don't know VB but in C/C++/C# it would be:
C++
string rtfPath = "\"C:\\RTF Files\\000001.rtf\"";
 
Share this answer
 
Comments
hansoctantan 9-Nov-12 8:24am    
I will try it... Thanks
hansoctantan 9-Nov-12 8:31am    
It really works
Thanks a lot...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900