Hola,
Me gustaría crear un programa JMP que devuelva un error al usuario porque seleccionó el archivo de Excel incorrecto.
Aquí hay un ejemplo de mi programa:
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 )
)
)
);¿Es posible hacer una condición if? Si el archivo seleccionado no contiene la hoja de trabajo en cuestión, JMP devuelve el mensaje de error.
Sin embargo, no sé cómo hacerlo.
¿Alguien tiene una solución?
Muchas gracias por su respuesta,
Sebastián
Hay una función llamada Obtener hojas de trabajo de Excel(). Puedes combinarlo con Throw() o crear tu propia ventana modal, por ejemplo.
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");
);¡Muchas gracias funciona!