所以我试图让这个程序打开一个用户选择的文件,所以我先拥有它们 输入已经在桌面上的文件,并在名称后面加上.txt扩展名,然后我尝试在目录末尾添加名称,并在线上显示:10列:1类型不匹配任何帮助将不胜感激,谢谢。我是新手:)
Option Explicit
Dim a, b, c, d, e
Set a = createobject("wscript.shell")
c = msgbox("Welcome to my word finding program!", vbInformation+vbOkCancel+vbDefaultButton1+vbSystemModal, "Information: ")
b = inputbox("MAKE SURE THAT YOUR FILE IS ON YOUR DESKTOP!" &vbLf& "Please enter the name of your .txt file" &vbLf& "Rembmer to add .txt after it" &vbLf& "EX: Name.txt")
a.run"C:\Users\%username%\Desktop\", b
答案 0 :(得分:2)
a.run
a.run "C:\Users\%username%\Desktop\" & b
但是,路径和文件名可能包含空格,因此您应该始终引用它们(字符串中的引号被写为两个引号)
a.run """C:\Users\%username%\Desktop\" & b & """"