Namenskonflikt Excel 2007

Outsider77

Erfahrenes Mitglied
Hallo zusammen,

seit Kurzem erhalte ich folgende Meldung beim Öffnen einer Excel-Datei:

namenskonflikt.JPG

Per Klick auf einen Button soll im Hintergrund (unsichtbar) eine Excel-Datei geöffnet und ganz bestimmte Daten gelesen werden.
Hier mal der Code-Ausschnitt vbexpress2008:

Code:
Private Sub Artikelliste_auslesen()
        Dim Artikel As String
        Dim Verzeichnis As String
        Dim Datei_xlsm As String
        Dim xlapp As Microsoft.Office.Interop.Excel.Application

        Verzeichnis = Artikelliste & "\" & Saison_Prefix & "-" & Saison_Jahr & "\"
        Datei_xlsm = Verzeichnis & "Artikelübersicht " & Saison_Prefix & "-" & Saison_Jahr & ".xlsm"
        Artikel = Label1.Text.Remove(7)

        Try
            If Artikellisteninfos = True And CDbl(Saison_Jahr_kurz) > 10 And My.Computer.FileSystem.FileExists(Datei_xlsm) Then
                xlapp = New Microsoft.Office.Interop.Excel.Application
                xlapp.EnableEvents = False
                xlapp.Workbooks.Open(Datei_xlsm, , ReadOnly:=True)
                xlapp.Visible = False
                xlapp.Cells.Find(Artikel).Activate()
                If CStr(xlapp.Cells.Find(Artikel).Text) <> "" Then
                    GroupBox4.Visible = True
                    PositionY = CStr(xlapp.ActiveCell.Column)
                    PositionX = CStr(xlapp.ActiveCell.Row)

                    If CDbl(xlapp.ActiveCell.Interior.ColorIndex) = 3 Then
                        MsgBox("Artikel laut Artikelliste entfallen")
                    End If

                    xlapp.Goto(xlapp.Cells(PositionX, CDbl(PositionY) + 8))
                    Label34.Text = CStr((xlapp.ActiveCell.Value))
                    xlapp.Goto(xlapp.Cells(PositionX, CDbl(PositionY) + 9))
                    Label35.Text = CStr((xlapp.ActiveCell.Value))
                    xlapp.Goto(xlapp.Cells(PositionX, CDbl(PositionY) + 10))
                    Label36.Text = CStr((xlapp.ActiveCell.Value))
                    xlapp.Goto(xlapp.Cells(PositionX, CDbl(PositionY) + 13))
                    Label37.Text = CStr((xlapp.ActiveCell.Value))
                    xlapp.Goto(xlapp.Cells(PositionX, CDbl(PositionY) + 14))
                    Label38.Text = CStr((xlapp.ActiveCell.Value))
                    xlapp.Goto(xlapp.Cells(PositionX, CDbl(PositionY) + 16))
                    Label39.Text = CStr((xlapp.ActiveCell.Value))

                    xlapp.EnableEvents = True
                    xlapp.ActiveWorkbook.Close(SaveChanges:=False)
                    xlapp.Quit()

                End If
            Else
                GroupBox4.Visible = False
            End If
        Catch
            'MsgBox("Artikel nicht in Artikelliste vorhanden")
        End Try

        xlapp = Nothing

    End Sub

Per Einzelschritt festgestellt, dass die Meldung in Zeile 15 kommt.
Ich habe bereits einiges dazu gefunden und probiert, so z.B. im Namensmanager in der Exceldatei alle Bereiche gelöscht, dies brachte jedoch keine Veränderung.
Wenn ich die Excel-Datei händisch im Explorer öffne, kommt das Fenster mit dem Namens-Konflikt nicht.

Auch seltsam ist, dass eine Vorgänger-Datei (gleiche Struktur, Aufbau und Code, lediglich die Daten und der Datei-Name sind unterschiedlich) sich ohne Probleme öffnen läßt.

Weiß jemand Rat oder eine Lösung für das Problem? Bin für jede Hilfe dankbar!

Gruß Outi

Edit:
Wenn ich den Code in vbexpress2010 debugge, kommt kein Namens-Konflikt-Fenster?
Wo könnte der Unterschied liegen?
 
Zuletzt bearbeitet:

Neue Beiträge

Zurück