<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Return of an error to the user because of a wrong Excel file selected in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/Return-of-an-error-to-the-user-because-of-a-wrong-Excel-file/m-p/725634#M91027</link>
    <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to create a JMP program which returns an error to the user because he selected the wrong Excel file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is an example of my program:&lt;/P&gt;&lt;P&gt;The&amp;nbsp;&amp;nbsp;&lt;CODE class=" language-jsl"&gt;file_path&lt;/CODE&gt;&amp;nbsp;contains the path to the file selected by the user.&lt;/P&gt;&lt;P&gt;However, I would like to return a message error when the&amp;nbsp;&lt;CODE class=" language-jsl"&gt;Worksheets( "AAA" )&lt;/CODE&gt;&amp;nbsp;is not contained in the Excel file selected by the user: because he didn't choose the right Excel file.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Funct = Function( {file_path, visib},
	Eval(
		Eval Expr(
			myTable = Open(
				file_path, 
				Worksheets( "AAA" ),
				Use for all sheets( 1 ),
				Concatenate Worksheets( 0 ),
				..
				),
				Expr( visib )
			)
		)
	);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Is it possible to make an if condition ? If the file selected doesn't contains the worksheet in question, then JMP returns the message error ?&lt;/P&gt;&lt;P&gt;However, I don't know how to make it.&lt;/P&gt;&lt;P&gt;Does anyone have a solution?&lt;/P&gt;&lt;P&gt;Thank you very much for your answer,&lt;/P&gt;&lt;P&gt;Sébastien&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 27 Feb 2024 18:23:40 GMT</pubDate>
    <dc:creator>Sebastienlg</dc:creator>
    <dc:date>2024-02-27T18:23:40Z</dc:date>
    <item>
      <title>Return of an error to the user because of a wrong Excel file selected</title>
      <link>https://community.jmp.com/t5/Discussions/Return-of-an-error-to-the-user-because-of-a-wrong-Excel-file/m-p/725634#M91027</link>
      <description>&lt;P&gt;Hello,&amp;nbsp;&lt;/P&gt;&lt;P&gt;I would like to create a JMP program which returns an error to the user because he selected the wrong Excel file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is an example of my program:&lt;/P&gt;&lt;P&gt;The&amp;nbsp;&amp;nbsp;&lt;CODE class=" language-jsl"&gt;file_path&lt;/CODE&gt;&amp;nbsp;contains the path to the file selected by the user.&lt;/P&gt;&lt;P&gt;However, I would like to return a message error when the&amp;nbsp;&lt;CODE class=" language-jsl"&gt;Worksheets( "AAA" )&lt;/CODE&gt;&amp;nbsp;is not contained in the Excel file selected by the user: because he didn't choose the right Excel file.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Funct = Function( {file_path, visib},
	Eval(
		Eval Expr(
			myTable = Open(
				file_path, 
				Worksheets( "AAA" ),
				Use for all sheets( 1 ),
				Concatenate Worksheets( 0 ),
				..
				),
				Expr( visib )
			)
		)
	);&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Is it possible to make an if condition ? If the file selected doesn't contains the worksheet in question, then JMP returns the message error ?&lt;/P&gt;&lt;P&gt;However, I don't know how to make it.&lt;/P&gt;&lt;P&gt;Does anyone have a solution?&lt;/P&gt;&lt;P&gt;Thank you very much for your answer,&lt;/P&gt;&lt;P&gt;Sébastien&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 27 Feb 2024 18:23:40 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Return-of-an-error-to-the-user-because-of-a-wrong-Excel-file/m-p/725634#M91027</guid>
      <dc:creator>Sebastienlg</dc:creator>
      <dc:date>2024-02-27T18:23:40Z</dc:date>
    </item>
    <item>
      <title>Re: Return of an error to the user because of a wrong Excel file selected</title>
      <link>https://community.jmp.com/t5/Discussions/Return-of-an-error-to-the-user-because-of-a-wrong-Excel-file/m-p/725636#M91028</link>
      <description>&lt;P&gt;There is a function called Get Excel Worksheets(). You can combine it with Throw() or make your own modal window for example&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;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");
);&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Tue, 27 Feb 2024 18:27:24 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Return-of-an-error-to-the-user-because-of-a-wrong-Excel-file/m-p/725636#M91028</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-02-27T18:27:24Z</dc:date>
    </item>
    <item>
      <title>Re: Return of an error to the user because of a wrong Excel file selected</title>
      <link>https://community.jmp.com/t5/Discussions/Return-of-an-error-to-the-user-because-of-a-wrong-Excel-file/m-p/733251#M91460</link>
      <description>&lt;P&gt;Thanks a lot it works!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 12 Mar 2024 09:39:37 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/Return-of-an-error-to-the-user-because-of-a-wrong-Excel-file/m-p/733251#M91460</guid>
      <dc:creator>Sebastienlg</dc:creator>
      <dc:date>2024-03-12T09:39:37Z</dc:date>
    </item>
  </channel>
</rss>

