Find in excel

Belias
Member Posts: 2,998
i am trying to do a find in excel directly from nav.
i have no prob to open and read the file, i also thought to use excel buffer to find the value i am searching.
the problem is that i have to find the last value, insert one or more lines below (in excel) and then proceed with a different value.
as you can imagine, excel buffer will record only the first situation, but after inserting one line, all the other line numbers will be messed out.
Then i can solve my problem only with the excel find (and then retrieve the line and col numbers)
anybody have an idea?
thanks in advance
i have no prob to open and read the file, i also thought to use excel buffer to find the value i am searching.
the problem is that i have to find the last value, insert one or more lines below (in excel) and then proceed with a different value.
as you can imagine, excel buffer will record only the first situation, but after inserting one line, all the other line numbers will be messed out.
Then i can solve my problem only with the excel find (and then retrieve the line and col numbers)
anybody have an idea?
thanks in advance
0
Answers
-
XlApp.Range('D1').EntireColumn.Find('SPTOR').Activate;
to finde 'sptor' in column "D". I tought it was more difficult
now, the second...how can I retrieve the line and column id where i actually am?0 -
intcolumnno := XlApp.activecell.row; introwno := XlApp.activecell.column;
with these instructions you can retrieve the number of the column and the row...if you want 'A1' instead of 1 1, you can validate the values in the excelbuffer and then retrieve the xlcolumnid value0 -
i solved this, too...I was hoping for a better way but no one replied
i've done the trick with the "codeunit.run"...I run the find function in the codeunit(passing xlapp)and I returned the value of the interested row(within a function launched from the Onrun of the codeunit)...
then I called the codeunit with "if" statement....so:
IF Codeunit.Run THEN Record is Found ELSE record is not found;
I will be happy to give a more detailed explanation if someone needs this!0 -
here's a sample code
CUUtilityErr.FNTGetPar('FINDXLSERR','A1',"No.",XlApp); IF NOT CUUtilityErr.RUN THEN BEGIN INTFirstRow := CUUtilityErr.FNTParBack; END ELSE MESSAGE('VALUE FOUND');
CODEUNIT:OnRun() CASE TXTGlobErrType OF 'FINDXLSERR': BEGIN FNTFindExcelError(TXTGlobWhere,TXTGlobWhat); END; END; FNTFindExcelError(TXTRange : Text[30];TXTCellValue : Text[50]) : Integer XlApp.Range(TXTRange).EntireColumn.Find(TXTCellValue).Activate; INTRowNo := XlApp.ActiveCell.Row; EXIT(INTRowNo); FNTGetPar(TXTLocErrType : Text[30];TXTLocWhere : Text[50];TXTLocWhat : Text[30];XlLocApp : Automation "Unknown Automation Server.Applic CASE TXTLocErrType OF 'FINDXLSERR': BEGIN TXTGlobWhat := TXTLocWhat; TXTGlobWhere := TXTLocWhere; TXTGlobErrType := TXTLocErrType; XlApp := XlLocApp; END; END; FNTParBack() : Integer CASE TXTGlobErrType OF 'FINDXLSERR': BEGIN EXIT(INTRowNo); END; END;
0 -
Tnks it works good! =P~0
-
i improve a little your code for give me cells and collums position and for merge cells.
My problem was the error doing activate cells, when excel don't find any match.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