Bonjour,
Je vous contact aujourd'hui car je n'arrive pas a résoudre mon problème.
Le problème est que je n'arrive pas a ressortir un string de mes get_Item pour pouvoir les comparé a un autre String.
Je vous remercie pour votre aide.

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
private bool VerrificationExel(string folderToCheck, string excelFile)
{
try
{
folderToCheck = folderToCheck.Substring(37, 15);
int i = 1;
object M = System.Reflection.Missing.Value;
Microsoft.Office.Interop.Excel.Application xslApp = new Microsoft.Office.Interop.Excel.Application();
xslApp.Visible = true;
xslApp.Workbooks.Open(@"chemin.xls", M, M, M, M, M, M, M, M, M, M, M, M, M, M);
Microsoft.Office.Interop.Excel.Range range = (((Microsoft.Office.Interop.Excel.Worksheet)(xslApp.ActiveWorkbook.ActiveSheet)).Cells);
 
while (range.get_Item(i, 2) != null)
{
 
if (range.get_Item(i, 2).Equals(folderToCheck) && range.get_Item(i, 207).Equals("O"))
{
richTextBox1.SelectedText = ("ok\n");
return true;
}
else
{
i++;
richTextBox1.SelectedText = ("condition noOK\n");
}
xslApp.Quit();
}
richTextBox1.SelectedText = ("quitter la boucle\n");
 
 
return false;
}
catch(Exception)
{
MessageBox.Show("erreur c'est produite", "erreur", MessageBoxButtons.OK, MessageBoxIcon.Error);
return false;
}
 
}