Zugriff auf bereits geöffnete Excel datei

  • VB.NET
  • .NET (FX) 4.0

Es gibt 7 Antworten in diesem Thema. Der letzte Beitrag () ist von Schamash.

    Zugriff auf bereits geöffnete Excel datei

    Hallo zusammen,

    ich habe einen zugriff auf eine Excel datei Text für conString wird usammengebaut da :

    VB.NET-Quellcode

    1. Provider = "Microsoft.ACE.OLEDB.12.0"
    2. ExProp = "Excel 12.0"
    3. 'oder auch --- Je nach dem wecher Treiber zur Verfügung steht.
    4. Provider = "Microsoft.Jet.OLEDB.4.0"
    5. ExProp = "Excel 8.0"
    6. Dim con As New OleDbConnection(String.Format("Data Source={0};Provider={1};Extended Properties=""{2};HDR={3};IMEX=1""", DateiName, Provider, ExProp, If(Kopfzeile, "Yes", "No")))

    Jetzt habe ich das Problem das die connection fehl schlägt wenn die Datei bereits durch einen Nutzer mit Excel geöffnet ist.
    Ich fange das zwar mit einer "ist schon offen, versuchen sie es später" Meldung ab aber da der zugriff nur ein Lesender sein muss hatte ich gehoft es gibt eine "öffne Schreibgeschützt" einstellung für die OleDbConnection
    There is no CLOUD - just other people's computers

    Q: Why do JAVA developers wear glasses?
    A: Because they can't C#

    Daily prayer:
    "Dear Lord, grand me the strength not to kill any stupid people today and please grant me the ability to punch them in the face over standard TCP/IP."
    Vielleicht hilft dir das Freigeben weiter, aber das ist nur bedingt für wenige Anwendungsfälle sinnvoll. (u.a. siehe Link)

    LG Acr0most
    Wenn das Leben wirklich nur aus Nullen und Einsen besteht, dann laufen sicherlich genügen Nullen frei herum. :D
    Signature-Move 8o
    kein Problem mit privaten Konversationen zu Thema XY :thumbup:
    @Acr0most Danke, aber in dem Fall müsste der "sperrende" selbst ja Freigeben. Das fällt raus, ich bin hier froh wenn der Anwender Word und Excel auseinanderhalten kann.

    @Mono Das wollte ich zwar vermeiden, glaube aber auch das ist die einzige Lösung.
    There is no CLOUD - just other people's computers

    Q: Why do JAVA developers wear glasses?
    A: Because they can't C#

    Daily prayer:
    "Dear Lord, grand me the strength not to kill any stupid people today and please grant me the ability to punch them in the face over standard TCP/IP."
    @petaod Ich hatte beide optionen schon gefunden leider brachten Sie keinen Erfolg.
    Meine Test verliefen allerdings unter der Microsoft.Jet.OLEDB.4.0 Umgebung. Ich habe irgentwo gelesen das Mode oder ReadOnly nur unter Microsoft.ACE.OLEDB.12.0 zur verfügung steht.
    There is no CLOUD - just other people's computers

    Q: Why do JAVA developers wear glasses?
    A: Because they can't C#

    Daily prayer:
    "Dear Lord, grand me the strength not to kill any stupid people today and please grant me the ability to punch them in the face over standard TCP/IP."
    @petaod Wenn das privat wäre, hätte ich damit kein problem.
    Hier im Betrieb bin ich an bestimmte Vorgaben gebunden.
    There is no CLOUD - just other people's computers

    Q: Why do JAVA developers wear glasses?
    A: Because they can't C#

    Daily prayer:
    "Dear Lord, grand me the strength not to kill any stupid people today and please grant me the ability to punch them in the face over standard TCP/IP."