Excel Automation

James_P_Sullivan
Member Posts: 5
Hey,
I have a serious problem.
I have an excel file, which I initiate with dates.
When this is done, I compare these dates with dates from navision.
Now, sometimes there is a major crash in navision.
This happens when navision is trying to get a date from the excel file.
The weird thing is that it only happens sometimes.
Now, my question is if there is someone who knows what could be the problem. I included the code below:
I have a serious problem.
I have an excel file, which I initiate with dates.
When this is done, I compare these dates with dates from navision.
Now, sometimes there is a major crash in navision.
This happens when navision is trying to get a date from the excel file.
The weird thing is that it only happens sometimes.
Now, my question is if there is someone who knows what could be the problem. I included the code below:
FOR i := 9 TO 39 DO BEGIN tempDummy := cduExcel.fctGetCellValue('D' + FORMAT(i)); CLEAR(tempDate); EVALUATE(tempDate, tempDummy); IF (DATE2DMY(tempDate, 1) = DATE2DMY("Posting Date", 1)) AND (DATE2DMY(tempDate, 2) = DATE2DMY("Posting Date", 2)) AND (DATE2DMY(tempDate, 3) = DATE2DMY("Posting Date", 3)) THEN BEGIN fctPrintValue(WTCode, Quantity, i); END; END;
0
Comments
-
Are you sure there is always a date filled in in cells D9..D39?
Maybe it's something in the function cduExcel.fctGetCellValue, that there is a problem with empty cells?No support using PM or e-mail - Please use this forum. BC TechDays 2024: 13 & 14 June 2024, Antwerp (Belgium)0 -
I checked that.
And that's not the problem
But I think I solved the problem.
To retrieve the date from the excel file, it has to get it from a template sheet. And afterwards, return it to another sheet.
The problem was that excel was switching from one sheet to the other, and it seemes like navision couldn't handle that.
So, now I don't let excel switch between the sheets, but just retrieve the value from the one sheet, without excel letting activate the sheet.
It seems to work now, so I think that was the problem.0 -
Seems it is not yet completely solved...
It works most of the time.
But sometimes it still gives an fatal error.
The strange thing is that the error is for navision, and not for excel.
And another strange thing is that it happens on different times, the first job, somewhere in the middle, the last...
It is very strange...
If anyone has an idea what the problem could be, please tell me, because it's killing me...0 -
Whay do you mean by fatal error. Does navision Crash?
If not, what is the error code and description.
If navision crashes i would look first if the datatypes in excel and Navision matches each other ..
What datatype do you use? Variants?In a world without Borders or Fences, who needs Windows and Gates?0 -
Well, the problem is gone now.
I worked around it.
But, it is still not possible to get data from excel.
I use a function that reads the range.value from excel.
This returns a variant, but I parse it with the format function.
So, the type I get is text.
And yes, navision crashes...
It's like when you can send the report to microsoft.0
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