Could not match column title if closing excel

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello.
I have this Rule below that reads some data from an Excel file. (It's longer than this, but this is the part that's not working)
Dim minV As Double = Double.MaxValue Dim minV_1 As Double = Double.MaxValue Dim minV_2 As Double = Double.MaxValue Dim List_45_35_L As New ArrayList Dim List_NL_L As New ArrayList Dolžina_Obstoječa_NL_L = GoExcel.CellValues("\\BASIC-SRV\Inventor\GostolTST_AI\iLogic POLŽ\iLogic_OBSTOJEČE_POLŽEVKE_FI_200.xlsx", "NOTRANJA LEVO", "B3", "B1000") Dolžina_Obstoječa_45_35_L = GoExcel.CellValues("\\BASIC-SRV\Inventor\GostolTST_AI\iLogic POLŽ\iLogic_OBSTOJEČE_POLŽEVKE_FI_200.xlsx", "ČEP FI 45_35", "B3", "B1000") For Each oItem1 In Dolžina_Obstoječa_45_35_L List_45_35_L.Add(oItem1) Next For Each oItem2 In Dolžina_Obstoječa_NL_L List_NL_L.Add(oItem2) Next For i = 0 To List_45_35_L.Count - 1
If Abs(List_45_35_L(i) - ((Vmesno:1 - 40) / 2)) < minV_1 minV_1 = Abs(List_45_35_L(i) - ((Vmesno:1 - 40) / 2)) a_1 = i End If Next For i = 0 To List_NL_L.Count - 1 If Abs(List_NL_L(i) - ((Vmesno:1 - 40) / 2)) < minV_2 minV_2 = Abs(List_NL_L(i) - ((Vmesno:1 - 40) / 2)) a_2 = i End If Next Polževka_45_35_dolžina = List_45_35_L(a_1) GoExcel.TitleRow = 2 b = GoExcel.FindRow("\\BASIC-SRV\Inventor\GostolTST_AI\iLogic POLŽ\iLogic_OBSTOJEČE_POLŽEVKE_FI_200.xlsx", "ČEP FI 45_35", "DOLŽINA_L [mm]", "=", Polževka_45_35_dolžina) Polževka_45_35 = GoExcel.CellValue("\\BASIC-SRV\Inventor\GostolTST_AI\iLogic POLŽ\iLogic_OBSTOJEČE_POLŽEVKE_FI_200.xlsx", "ČEP FI 45_35", "A" & b) Polževka_NL_dolžina = List_NL_L(a_2) GoExcel.TitleRow = 2 b = GoExcel.FindRow("\\BASIC-SRV\Inventor\GostolTST_AI\iLogic POLŽ\iLogic_OBSTOJEČE_POLŽEVKE_FI_200.xlsx", "NOTRANJA LEVO", "DOLŽINA_D [mm]", "=", Polževka_NL_dolžina) Polževka_NL = GoExcel.CellValue("\\BASIC-SRV\Inventor\GostolTST_AI\iLogic POLŽ\iLogic_OBSTOJEČE_POLŽEVKE_FI_200.xlsx", "NOTRANJA LEVO", "A" & b)
Now this all works perfectly fine, until I simulate another part of my code (located in a part of my assembly) which accesses another Excel file, writes some data to it and then saves and closes that file.
When the code returns to this first rule, I guess the Excel file is closed and the TitleRow and FindRow doesn't work because of it?
To simulate the part of the rule that is written in another part, insert an GoExcel.Close after reading the values:
Dolžina_Obstoječa_NL_L = GoExcel.CellValues("\\BASIC-SRV\Inventor\GostolTST_AI\iLogic POLŽ\iLogic_OBSTOJEČE_POLŽEVKE_FI_200.xlsx", "NOTRANJA LEVO", "B3", "B1000")
Dolžina_Obstoječa_45_35_L = GoExcel.CellValues("\\BASIC-SRV\Inventor\GostolTST_AI\iLogic POLŽ\iLogic_OBSTOJEČE_POLŽEVKE_FI_200.xlsx", "ČEP FI 45_35", "B3", "B1000")
GoExcel.Close
After doing this, the GoExcel.FindRow stops working (could not match column title). Even if I write a GoExcel.Open("excelfilepath", "sheet"), it still can't find the column title.
I've attached the Excel file.
Any help would be very appreciative, I've been losing my mind over this for quite some time now.