Before you start coding you need to ask yourself a few questions first. The solution is dictated by your needs. Questions like the following should get you started:
1. Does the data truly have to be in Excel format or will a Comma Seperated (.csv) file work?
2. How much data is being exported (a couple of rows or hundreds of rows)?
Typically, the TEXT_IO or WebUtil's CLIENT_TEXT_IO pacakages are used to write data from a Form to a file. Which one you use is dependent on where you want the file exported too. With Forms 9i and higher, the TEXT_IO pacakage will write your file to Application Server, with Forms 6 and lower, it writes the file to the Client. If your Forms application is web deployed and you need to write the file to the Client computer, you will need to use WebUtil's CLIENT_TEXT_IO package or write the file to the application server and then transfer the file to the client (also using WebUtil).
Depending on how much data you are write will also impact which option you choose. If you are write and small number of rows (less than 100) then writing the file directly to the Client would be ok. If you are dealing with more than 100 rows, I recommend you write the file to the Database or Application Server and then transfer the file to the client as writing data from a Form to a client file will be very very slow with larger data sets.
For information on using either TEXT_IO or CLIENT_TEXT_IO, please search the Forms Help System for either package name.