Activate Excel Workbook

MMaier1
Member Posts: 5
Answers
-
Where is it erroring in the code?
Activate the debugger and show us where it stops.0 -
xlWrkBk is null: xlApp.ActiveWorkbook doesn't active xlWrkBk and I don't understand the reason0
-
You're just opening the Excel Application - there is no current workbook. I think you need to open a workbook or create one0
-
I'm using Excel Buffer table and I thought workbook was still activated, but it doesn't seem0
-
To open workbook and later use dotnet, you must use OpenBookDotNet custom function in ExcelBuffer table which looks something like this:
ClientTempFileName := ThreeTierMgt.ClientTempFileName(PathRTC.GetExtension(FileName));
FileRTC.Copy(FileName, ClientTempFileName);
UPLOADINTOSTREAM('',ThreeTierMgt.Magicpath,'',ClientTempFileName,NVInStream);
MemoryStream := NVInStream;
XlWrkBkDotNet := XlWrkBkDotNet.XLWorkbook(MemoryStream);
i := 1;
EndOfLoop := XlWrkBkDotNet.Worksheets.Count;
WHILE (i <= EndOfLoop) AND (NOT Found) DO BEGIN
XlWrkshtsDotNet := XlWrkBkDotNet.Worksheet(i);
IF SheetName = XlWrkshtsDotNet.Name THEN
Found := TRUE;
i := i + 1;
END;
IF Found THEN
XlWrkShtDotNet := XlWrkBkDotNet.WorksheetString(SheetName)
ELSE BEGIN
CLEAR(XlWrkBkDotNet);
END;
For DotNet Variables XlWrkShtDotNet, XlWrkBkDotNet etc, you need to use ClosedXML.Excel.XLWorkbook assemblies0
Categories
- All Categories
- 73 General
- 73 Announcements
- 66.6K Microsoft Dynamics NAV
- 18.7K NAV Three Tier
- 38.4K NAV/Navision Classic Client
- 3.6K Navision Attain
- 2.4K Navision Financials
- 116 Navision DOS
- 851 Navision e-Commerce
- 1K NAV Tips & Tricks
- 772 NAV Dutch speaking only
- 617 NAV Courses, Exams & Certification
- 2K Microsoft Dynamics-Other
- 1.5K Dynamics AX
- 320 Dynamics CRM
- 111 Dynamics GP
- 10 Dynamics SL
- 1.5K Other
- 990 SQL General
- 383 SQL Performance
- 34 SQL Tips & Tricks
- 35 Design Patterns (General & Best Practices)
- 1 Architectural Patterns
- 10 Design Patterns
- 5 Implementation Patterns
- 53 3rd Party Products, Services & Events
- 1.6K General
- 1.1K General Chat
- 1.6K Website
- 83 Testing
- 1.2K Download section
- 23 How Tos section
- 252 Feedback
- 12 NAV TechDays 2013 Sessions
- 13 NAV TechDays 2012 Sessions