Autor Beitrag
tomycat
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 265
Erhaltene Danke: 1



BeitragVerfasst: Mi 20.01.21 12:49 
hallo,
ich habe mein Win 10 neu aufgesetzt.
Leider kommt ein Fehler, Office ist rot unterstrichen.

ausblenden C#-Quelltext
1:
2:
3:
4:
5:
// Creating a Excel object.
Microsoft.Office.Interop.Excel._Application excel = new Microsoft.Office.Interop.Excel.Application();
Microsoft.Office.Interop.Excel._Workbook workbook = excel.Workbooks.Add(Type.Missing);
Microsoft.Office.Interop.Excel._Worksheet worksheet = null;
...schnipp..

Office 2007 habe ich installiert sowie PIARedist.exe ohne Erfolg.

Über google kam ich auf eine Webseite, ich soll im Regedit soll ich die unbekannte Version löschen

Registry-Pfad: HKEY_CLASSES_ROOT\TypeLib\{00020905-0000-0000-C000-000000000046} -> 1.0 stand da und dieses Verzeichnis habe ich gelöscht. Auch ohne Erfolg.

Es ging mal, bzw mit dem alten System.

Moderiert von user profile iconTh69: Falsche durch richtige C#-Tags ersetzt.
Moderiert von user profile iconTh69: Code-Tags hinzugefügt
jaenicke
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 19272
Erhaltene Danke: 1740

W11 x64 (Chrome, Edge)
Delphi 11 Pro, Oxygene, C# (VS 2022), JS/HTML, Java (NB), PHP, Lazarus
BeitragVerfasst: Mi 20.01.21 13:05 
Im Projekt muss die Assembly als Verweis eingebunden werden. Wie das geht steht hier: Vorgehensweise: Zugreifen auf Office-Interop-Objekte

Moderiert von user profile iconTh69: URL-Titel hinzugefügt.

Für diesen Beitrag haben gedankt: tomycat
tomycat Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 265
Erhaltene Danke: 1



BeitragVerfasst: Mi 20.01.21 14:43 
Der Verweis ist schon drin, vom alten Projekt. Aber nicht verfügbar.
Wenn ich einen neue Verweis erstellen möchte, dann gib es keine Microsoft.Office

Ich habe in Windows einen ...
C:\Windows\assembly\GAC_MSIL\Microsoft.Office.Interop.SmartTag\14.0.0.0__71e9bce111e9429c\Microsoft.Office.Interop.SmartTag.dll
... gefunden

jetzt ist Excel in rot unterstrichen.
Th69
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Moderator
Beiträge: 4764
Erhaltene Danke: 1052

Win10
C#, C++ (VS 2017/19/22)
BeitragVerfasst: Mi 20.01.21 18:31 
Das ist nicht die richtige Referenz für Excel.
Sind beim "Add Reference"-Dialog unter "COM" keine "Microsoft.Office"-Assemblies vorhanden?

Welche VS-Version verwendet du eigentlich? (könntest diese in deinem Profil eintragen)

Für diesen Beitrag haben gedankt: tomycat
tomycat Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Beiträge: 265
Erhaltene Danke: 1



BeitragVerfasst: So 24.01.21 19:56 
thx,
genau so ist es.
Unter Com blabla war Excel drin.
VS 2019 nutze ich.
Th69
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starontopic star
Moderator
Beiträge: 4764
Erhaltene Danke: 1052

Win10
C#, C++ (VS 2017/19/22)
BeitragVerfasst: Mo 25.01.21 10:33 
Laut Cannot find Microsoft.Office.Interop Visual Studio mußt du noch die Office Developer Tools nachinstallieren.
Am besten über den "VS2019 Installer": Ändern -> Einzelne Komponenten: nach "Office" suchen -> "Office Developer Tools für Visual Studio"