你好,
我想創建一個 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");
);