未声明Filename变量 [英] Filename variable not declared
问题描述
嗨!
观察下面的代码片段。最后一行显示"Filename = Dir(path)"   "文件名"以前没有声明过。是"文件名"吗?保留字?或者,是"使用此单个
最后一行声明和初始化文件名?谢谢! -   John
Observe the below snippet of code. The last line which says "Filename = Dir(path)" "Filename" is not previously declared. Is "Filename" a reserved word? Or, is "Filename declared and initialized with this single last line? Thanks! - John
推荐答案
您好
如果想要使用'文件名',您需要声明它。
If want to use 'Filename' you would need to declare it.
例如,Dim文件名为string = folderPath& " * .stp"
For example, Dim Filename as string = folderPath & "*.stp"
更好的是,也许 Dim Filename As String = IO.Path.Combine(folderPath," * .stp")会更好。
Better still, maybe Dim Filename As String = IO.Path.Combine(folderPath, "*.stp") would be better.
你想要实现什么,因为我认为你可能走错了路。您是否要列出目录中的all.stp文件?
What are you trying to achieve, as I think you may be on the wrong track. Are you wanting to list all.stp files from a directory?
这篇关于未声明Filename变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!