excel file stays open

nightrod
Member Posts: 68
Hi all,
i have created a repport to fill in an excel template through the excel buffer.
the report opens the file C:\Temp\template.xls
the data is inserted to the excel file.
than i use the save as funciont to store it as c:\temp\Results.xls
this all works fine except the template.xls file stays open in background.
how can i close this file?
thanks.
i have created a repport to fill in an excel template through the excel buffer.
the report opens the file C:\Temp\template.xls
the data is inserted to the excel file.
than i use the save as funciont to store it as c:\temp\Results.xls
this all works fine except the template.xls file stays open in background.
how can i close this file?
thanks.
0
Comments
-
[Topic moved from 'NAV Tips & Tricks' forum to 'NAV/Navision Classic Client' forum]
You need to create a new function in which there is the command to close the file (or you can add it to the function where you save the file).Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
Ok, but how do i select the open template.xls again?
because the last active file was the result.xls file.0 -
You already have it. Just after the saving, you can close the sheet.Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
-
hi all,
thanks for your support. unfortunatly the solution is still not there.
when i call close function again i got the message:
Could not invoke the member close. the ole control returned a unknown message.SaveWorkBook(FileName : Text[250]) XlWrkBk.SaveAs(FileName); XlWrkBk.Close(FALSE); XlWrkBk.Close(FALSE); XlApp.Quit; CLEAR(XlApp);
i try to explain the problem more clearly:
-open template.xls
-modify data
-save as restults.xls
the excel file results.xls is closed but the file template.xls stays open in background.0 -
You have 2 times the line : XlWrkBk.Close(FALSE);
The second close-command generates the error because you just closed it.Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!0 -
i understand that.
but how can i close the template.xls file?0 -
1. you open the template.xls
2. you save it as Results.xls. At the moment you save it as Results.xls, the template.xls HAS BECOME Results.xls.
3. you close Results.xls. You don't need to close template.xls anymore.Regards,Alain Krikilion
No PM,please use the forum. || May the <SOLVED>-attribute be in your title!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