Answered by:
data exported to excel file and excel file opened it self

Question
-
I uses following command to export data into an excel file.
USE FILENAME
COPY TO <FILENAME> TYPE XLS
It works well. It exports data to excel file and I cal open this excel file by double clicking on that. But what I need is that I want that excel file is opened automatically after generation.
Any code ?
Thanks
Deepak Kharpate
Thursday, August 30, 2012 4:46 PM
Answers
-
Try this
DECLARE INTEGER ShellExecute ; IN SHELL32.DLL ; INTEGER nWinHandle,; STRING cOperation,; STRING cFileName,; STRING cParameters,; STRING cDirectory,; INTEGER nShowWindow FILENAME = "c:\Users\test\Documents\Book2.xls" result = ShellExecute(0, 'Open', m.FILENAME , '', '', 1) DO CASE CASE result = 0 msg = "The system is out of memory or resources." CASE result = 2 msg = "Bad Association (for example, invalid URL)" CASE result = 29 msg = "Failure to load application" CASE result = 30 msg = "Application is busy " CASE result = 31 msg = "No application association" ENDCASE
Systems Analyst
- Edited by Vladimir Zografski Thursday, August 30, 2012 6:34 PM
- Proposed as answer by mplaza Friday, August 31, 2012 5:04 PM
- Marked as answer by Deepak Kharpate Saturday, September 1, 2012 7:14 AM
Thursday, August 30, 2012 6:32 PM
All replies
-
Try this
DECLARE INTEGER ShellExecute ; IN SHELL32.DLL ; INTEGER nWinHandle,; STRING cOperation,; STRING cFileName,; STRING cParameters,; STRING cDirectory,; INTEGER nShowWindow FILENAME = "c:\Users\test\Documents\Book2.xls" result = ShellExecute(0, 'Open', m.FILENAME , '', '', 1) DO CASE CASE result = 0 msg = "The system is out of memory or resources." CASE result = 2 msg = "Bad Association (for example, invalid URL)" CASE result = 29 msg = "Failure to load application" CASE result = 30 msg = "Application is busy " CASE result = 31 msg = "No application association" ENDCASE
Systems Analyst
- Edited by Vladimir Zografski Thursday, August 30, 2012 6:34 PM
- Proposed as answer by mplaza Friday, August 31, 2012 5:04 PM
- Marked as answer by Deepak Kharpate Saturday, September 1, 2012 7:14 AM
Thursday, August 30, 2012 6:32 PM -
It's not what you asked, but I'd suggest that you change TYPE XLS to TYPE XL5. TYPE XLS creates an Excel 2.0 format file. There were important changes after that in the way the Excel handles dates.
Tamar
Thursday, August 30, 2012 8:32 PMAnswerer -
-
Thanks A Lot
I uses your given code and I achieved what I Want.
Thanks Again
Deepak Kharpate
Saturday, September 1, 2012 7:15 AM