Article ID: 148406
Article Last Modified on 3/14/2005
*-- Connect to an Microsoft Excel Data Source
* The parameter passed with SQLCONNECT is the name of the data source.
* The default for Microsoft Excel is Excel Files. If there is any
* trouble with this, execute it with no parameter and a list of
* currently available data sources will come up. The text of the
* listing that pertains to Microsoft Excel is the actual value to pass
* as a parameter. Retry it with that value.
*
* Still from within the SQLCONNECT() function, a "Select Workbook"
* dialog will come up. Next, the program performs some error checking.
* Finally, Microsoft Excel is told which sheet of the workbook is desired
* within the SQLEXEC() function with the "Sheetn$" where "n" is a
* number from 1 to the number of sheets in the workbook.
nConnHand = SQLCONNECT("Excel Files")
IF nConnHand > 0
=MESSAGEBOX("Connected to Microsoft Excel File",0)
ELSE
=MESSAGEBOX("Unable to connect to Microsoft Excel File ..",0)
ENDIF
nXResult = SQLEXEC(nConnHand, 'SELECT * FROM "Sheet1$"','MyCursor')
Additional query words: VFoxWin
Keywords: kbhowto kbcode KB148406