Good day everyone.
In the Vista/Excel 2007 envirnonment I have found a workaround to a 'bug'.
First off, DO NOT OPEN an excel spreedsheet in Vista. For some reason, it autoupdates something in the file(and I am not talking about .xlsx), making it incompatible with FoxPro. If you need to look into the file that the client gives you, copy it and look at the copy only, leave the original untouched.
{Note: if you need to create an excel file in Vista/Excel 2007, you must save it in a 95 format, and use type xl5 in FoxPro. A coding nightmare, and one that we cannot expect clients to do!}
Then to copy in multiple worksheet names, and populate a database use something like:
fileN = getfile()
s = createobject("excel.application")
with s
s.DisplayAlerts = .F. && prevent Excel from pushing any dialog boxes
s.workbooks.Open(fileN, .F., .T.) && readonly
t = s.ActiveWorkbook.Sheets.Count
DIMENSION arrays[t] AS String
k = t
num = k
t = 1
do while k > 0 && populate the tab names into an array
store s.ActiveWorkbook.Sheets[t].name to arrays[t]
k = k - 1
t = t + 1
enddo
k = num
t = 1
s.quit &&closes the excel object from system memory
s= .NULL.
release s
endwith
&&populate the sourcefile
do while k > 0
name = (arrays[t])
select sourcefile
append from (fileN) type XL8 SHEET (name) for fieldOne <> 0
replace tabname with name for len(alltrim(tabname)) = 0
k = k - 1
t = t + 1
enddo
A little rough code, but it works in the newer microsoft enviroments.
Enjoy
Also, sorry If I do not respond to any comments/questions immediately, I only occasionaly check.