你好,
我想创建一个 JMP 程序,该程序向用户返回错误,因为他选择了错误的 Excel 文件。
这是我的程序的示例:
The file_path contains the path to the file selected by the user.
However, I would like to return a message error when the Worksheets( "AAA" ) is not contained in the Excel file selected by the user: because he didn't choose the right Excel file.
Funct = Function( {file_path, visib},
Eval(
Eval Expr(
myTable = Open(
file_path,
Worksheets( "AAA" ),
Use for all sheets( 1 ),
Concatenate Worksheets( 0 ),
..
),
Expr( visib )
)
)
);可以做一个if条件吗?如果所选文件不包含相关工作表,则 JMP 会返回错误消息?
但是,我不知道如何制作。
有没有人有办法解决吗?
非常感谢您的回答,
塞巴斯蒂安
有一个名为 Get Excel Worksheets() 的函数。例如,您可以将其与 Throw() 结合使用或制作自己的模式窗口
Names Default To Here(1);
sheetList = Get Excel Worksheets(
"$SAMPLE_IMPORT_DATA\Team Results.xlsx"
);
If(!Contains(sheetList, "AAA"),
Throw("No 'AAA' found from excel sheet list");
);