Select a sheet using Excel automation

Hanen
Member Posts: 281
I have a problem, how can I activate an existing worksheet it's a kind of selection or activation of a sheet in a workbook to fill with the write data. :-k
Example:
Sheet 1: if The payment is by check
Sheet 2: If the payment is by cash
Sheet 3: if the payment is by transfer
Sheet 4:...................................
Thanks for help. :oops:
Example:
Sheet 1: if The payment is by check
Sheet 2: If the payment is by cash
Sheet 3: if the payment is by transfer
Sheet 4:...................................
Thanks for help. :oops:
Regards
Hanen TALBI
Hanen TALBI
0
Comments
-
You can have a look at the functions in the excel buffer table. I think it was called selectsheetsname.0
-
The Sheetname can be passed to the OpenBook function as the second parameter.There are no bugs - only undocumented features.0
-
Can you give me examples please? :oops:Regards
Hanen TALBI0 -
Hanen wrote:Can you give me examples please? :oops:
Here's an example from some code I did a few years back:ProcessSetup.GET; ImportFile := ProcessSetup."Excel Import Path" + '\*.*'; ImportFile := CommDiag.OpenFile('Select Excel WorkBook', ImportFile, 2, '', 0); ExcelBuf2.OpenBook(ImportFile, ExcelBuf2.SelectSheetsName(ImportFile)); ExcelBuf2.ReadSheet; AnalyzeData; FIND('-');
The user is first prompted to select a Workbook file. Then the standard function SelectSheetsName presents a list of the available Worksheets from which the user chooses. AnalyzeData is custom finction to process data based on customer's needs.There are no bugs - only undocumented features.0 -
I want to do an export not an import.Regards
Hanen TALBI0 -
Hanen wrote:I want to do an export not an import.
this line of code in the above example just opens the file and selects a sheetExcelBuf2.OpenBook(ImportFile, ExcelBuf2.SelectSheetsName(ImportFile));
Then you have your sheet selected and all you need to do is write data to it.0 -
Hi,
I'm using only one dataitem and I want to export to three excel sheets using filters soomething like if rec1.Field = 'A' then Data will be exported into sheet1 else if rec1.Field='B' then data will be exported to sheet2 else exported to sheet3 :-k
Help!!!! :oops:Regards
Hanen TALBI0 -
Hanen wrote:Hi,
I'm using only one dataitem and I want to export to three excel sheets using filters soomething like if rec1.Field = 'A' then Data will be exported into sheet1 else if rec1.Field='B' then data will be exported to sheet2 else exported to sheet3 :-k
Help!!!! :oops:
all you need to do is replace the part below with sheet1 or sheet2 or sheet3 and then write your values to the correct cells.ExcelBuf2.SelectSheetsName(ImportFile)
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