Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Excel-FoxPro, first attempt on Automation

Status
Not open for further replies.

Kimed

Programmer
May 25, 2005
104
LT
Hi,

In the application I'm working on, I need to export a *large* portion of an Excel sheet into an external database and import it back. I wrote a program in Visual FoxPro 6.0 that would connect to an Excel sheet currently open and do the transfer, and all was well, until I figured I don't know how to launch it from Excel. After some digging in manuals, I rearranged procedures as OLEPUBLIC class' components (tested it again - while launching from FoxPro's side everything worked), compiled it into .exe and tried to call it as a COM "server" from Excel. The CreateObject seemed to work, but the very first call to object's procedure made Excel stuck for a couple of minutes, then it started to throw a message "Microsoft Office Excel is waiting for another application to complete an OLE action" periodically, which only could be stopped by killing the "server" process from the Task Manager.

Now, my current guess of the problem is that both applications are trying to see each other as a server and themselves as a client, which supposedly is a no-no. But I don't know how to resolve this situation. I can't make the FoxPro program a client application calling for the Excel server, as the Excel is what the user works with, and all parameters of the data exchange are set from there. And I'm not sure whether I can access Excel's contents directly from Foxpro if the latter works as a server. If I try to pass data to be transferred as functions' parameters, one row at a time, I'm afraid it's going to be unacceptably slow (didn't I say the piece of sheet is large?). Worse than that, I may need to call for a dialog from Fox' part as well, which, AFAIK, is not possible for a COM.

Thanks for any enlightening advice.
 
Any reason you can't just control all this from excel ? Can't really see any need for COM or exes here....

All you need is a connection to the database and then the SQL should do all your necessary import / export....

Rgds, Geoff

We could learn a lot from crayons. Some are sharp, some are pretty and some are dull. Some have weird names and all are different colours but they all live in the same box.

Please read FAQ222-2244 before you ask a question
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top