There still seems to be some on-going confusion as to what you wanted to do. Lets try to end that.
how I could just create an excel spreadsheet having been populated with data from a table without it actually opening
The only way to create an Excel spreadsheet using data from a FP/VFP data table without
opening the file is to do a simple
Code:
SELECT MyDBF
COPY TO NewXLS.xls xl5
That will create an Excel file with your FP/VFP data and not actually open Excel to do so.
Other approaches, which are good if not even better, will require Excel and the file to be
opened via Automation.
which for some unknown reason always shows the column headers
It is not for some "unknown reason", instead it is the result that you get when you use the simplistic
"COPY TO <whatever> XL5"
Using this command line approach, FP/VFP will put the field names into the new XLS file as Row #1.
once the file had been created, there was no actual need to open it
In order to Delete the first row from an existing Excel file, you
HAD to
OPEN Excel and the file via Automation - that is a given.
Code:
mfileopen = SYS(5)+SYS(2003)+"\"+TRIM(mfile)+".xls"
* ------
oXL = CREATEOBJECT("Excel.Application") [B]<-- OPENS Excel[/B]
oWorkbook = oXL.Workbooks.Open(mFileOpen) [B]<-- OPENS File Into Excel [/B]
oRange = oWorkbook.Sheets[1].Rows[1]
oRange.Delete()
oWorkbook.Save() [B]<-- Saves Excel File[/B]
oWorkbook.Close() [B]<-- Closes Excel[/B]
It seems as though instead of your goal as stated, what you really wanted was not to
leave the file open when done. And that you have accomplished with Tamar's code from above.
It might have been simpler and more expedient to merely ask about how to get your desired end result and have left out the "how to get there" part.
Regardless, you got your answers despite some confusion as to what you really wanted to accomplish - good.
Good Luck,
JRB-Bldr