Just google VFP Excel and you'll find lots of automation examples
Visit the FAQ section here and you again find lots of help in the section COM and Automation.
As you didn't attach a file there can be no specific help with it, but in general, you can automate Excel, open an existing file, any type xls, xlsx or xlt, xltx, xltm with macros embedded or not.
You can work with explicit cell row/column numbers to fill in single values and let the macros/code or simply cell formulas do their work. It's really not hard to do and to find this.
If you or your company creates the templates you can do things to simplify the automation process for FoxPro, you could, for example, put expressions into cells that could be evaluated by EVAL() or even better TEXTMERGE(), which can combine text portions and multiple expressions, and then put the result back. So you read and evaluate prepared templates from VFP with current data and reverse the process and program VFP from Excel, the designers of templates will either need to know VFP functions or you program function by your own names, because EVAL() and TEXTMERGE() can of course also execute user-defined functions. Your fantasy and ideas are your only limitations.
If you're not the template maintainer and it comes from a third party you're still able to modify a template not only by putting in some numbers in "user interface" cells and automate that, you can put in expressions, you can name ranges, not only rows and columns or rectangles but any arbitrary selection of cells and then address them by name.
And last not least, how to automate Excel is no secret. Microsft has the MSDN available publicly, including, for example, the Excel object model that tells you what objects and methods and properties exist in the Excel application, the workbooks or a sheet. If you do so interactive in the command line - and this is something I would generally recommend to anyone typically asking for code in forums, you learn and can investigate what else exists through intellisense. Even in the code editor non-interactively you can get intellisense while you write your code by defining:
Code:
LOCAL loExcel as Excel.Application, loSheet as Excel.Sheet
You just also need to set them so they become such objects, ie loExcel = CreateObject("Excel.Application") and later, after loading the template maybe loSheet = loExcel.ActiveWorkbook.ActiveSheet or loExcel.ActiveWorkbook.Sheets[1] or whatever sheet number is relevant for input into the template.
Also, even while you define LOCAL variables to store object references with the options AS clause and type Excel, intellisense already helps you see which Excel objects are available via COM, so take a look for yourself. Even just to have the names you can google for their MSDN reference description.
Bye, Olaf.
Olaf Doschke Software Engineering