我一直在网上搜索有关如何使用 VBScript 中的打开文件对话框打开文件的解决方案。有人可以指出我正确的轨道吗?
我下面的代码打开 Excel 文件,但我希望它更加动态,因为输入文件名可以更改而不是硬编码。
Set objExcel = CreateObject("Excel.Application")
objExcel.DisplayAlerts = 0
Set objShell = WScript.CreateObject("WScript.Shell")
path = objShell.CurrentDirectory
inFileName = "InputFile.xlsx"
inFilePath = path + "\" + inFileName
'Open target workbook
Set objWorkbook1 = objExcel.Workbooks.Open(inFilePath, False, True)
MsgBox "Reading Data from " & inFileName & vbNewLine, vbOkOnly + vbInformation, _
"Reading Data"