VBScript 中 FileDialog 无法运行:'Scripting.FileSystemObject' 对象不支持此属性或方法
'Scripting.FileSystemObject' 对象并不支持'FileDialog'属性或方法。您可能需要使用其他对象或方法来实现文件对话框的功能。具体取决于您的目标和需求,以下是一些可能的解决方案:
- 使用 WScript.Shell 对象的 Popup 方法来显示文件对话框,例如:
Set objShell = CreateObject('WScript.Shell')
strFilePath = objShell.Popup('请选择文件', , , 1 + 48)
- 使用 Shell.Application 对象的 FileOpenDialog 方法来显示文件对话框,例如:
Set objShell = CreateObject('Shell.Application')
Set objFileDialog = objShell.FileOpenDialog('请选择文件')
If objFileDialog.Show = 0 Then
For Each objFile in objFileDialog.SelectedItems
strFilePath = objFile.Path
Next
End If
请根据您的具体需求选择适合的解决方案,并确保在代码中正确引用所需的对象。
原文地址: https://www.cveoy.top/t/topic/qfzy 著作权归作者所有。请勿转载和采集!