VB6 Shell,打开RTF文件时出错.
问题描述:
我有一个自动打开RTF文件的程序.
这是我的代码
I have a program that automatically opens a RTF file.
This is my code
Shell "C:\Program Files\Windows NT\Accessories\wordpad.exe " & rtfPath, vbNormalFocus
执行该行时,将打开写字板,但我在写字板中遇到此错误C:\RTF Cannot find this file. Please verify that the correct file name are given.
好吧,实际路径是这个C:\RTF Files\000001.rtf
,我认为问题是空间.有没有一种方法可以打开文件,即使文件路径中有空格也是如此.
谢谢
When the line is executed the Wordpad opens but I''m getting this error in WordpadC:\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
答
您可能需要将路径字符串放在双引号中才能被接受.我不了解VB,但在C/C ++/C#中会是:
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:
string rtfPath = "\"C:\\RTF Files\\000001.rtf\"";