Veröffentlicht 25. September 201014 j Hallo zusammen, ich stehe vor folgendem Problem: Ich möchte eine Excel-Datei im aktiven Excel-Fenster öffnen, d.h. wie wenn ich die Datei direkt über Excel mit der Öffnen-Maske aufrufen würde. Mit meinem bisherigen Code öffnet sich die Excel-Datei in einem neuen Fenster: Dim exApp As Excel.Application = New Excel.Application() Dim exwb As Excel.Workbook Dim exsh As Excel.Worksheet Dim exrng As Excel.Range With exApp .Visible = True exwb = .Workbooks.Open(docpfull) exsh = exwb.Sheets(1) exrng = exsh.Range("A1") End With In der Variable "docpfull " ist der Pfad der zu öffnenden Datei hinterlegt. Ich hoffe Ihr könnt mir weiter helfen.
30. September 201014 j habe so etwas in C# gemacht.... // First Contact: Excel Prozess initialisieren myExcelApplication = new Microsoft.Office.Interop.Excel.Application(); myExcelApplication.Visible = true; myExcelApplication.ScreenUpdating = true; // Excel Datei anlegen: Workbook var myCount = myExcelApplication.Workbooks.Count; myExcelWorkbook = myExcelApplication.Workbooks.Add(System.Reflection.Missing.Value) as Microsoft.Office.Interop.Excel.Workbook; if (myExcelWorkbook == null) { throw new ArgumentNullException(); } Vielleicht hilft Dir das etwas weiter... mfg ron
30. September 201014 j Du willst ja eine Datei öffnen... string workbook = excelPath; xlWorkbook = xlApplication.Workbooks.Open( excelPath, 0, false, 5, "hallo", "hallo", true, XlPlatform.xlWindows, "\t", false, false, 0, false, 0, false ); // Wir nehmen das Lager-Arbeitsblatt try { xlWorksheet = xlWorkbook.Worksheets["Lager"] as Worksheet; xlWorksheet.Unprotect("hallo"); } catch (Exception) { MessageBox.Show("Kein Arbeitsblatt 'Lager' vorhanden!"); return; } ...trage dein Pfad in excelPath ein...und ändere das Blatt was Du öffnen möchtest... mfg ron
Archiv
Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.