Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. sponsors. rss.
 From: Christopher Kemper
  Where is Christopher Kemper?
 Valparaiso
 Indiana - United States
 Christopher Kemper
 Tags
Subject: Vista Excel Compatibility w/ Worksheets
Thread ID: 153535 Message ID: 153535 # Views: 111 # Ratings: 0
Version: Visual FoxPro 9 Category: Classes and Objects
Date: Wednesday, December 05, 2007 7:23:29 PM         
   


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.



COMPLETE THREAD
Vista Excel Compatibility w/ Worksheets Posted by Christopher Kemper @ 12/5/2007 7:23:29 PM
RE: Vista Excel Compatibility w/ Worksheets Posted by Cetin Basoz @ 12/5/2007 7:29:33 PM
RE: Vista Excel Compatibility w/ Worksheets Posted by Christopher Kemper @ 12/5/2007 7:34:00 PM
RE: Vista Excel Compatibility w/ Worksheets Posted by Christopher Kemper @ 12/6/2007 11:08:23 PM
RE: Vista Excel Compatibility w/ Worksheets Posted by Cetin Basoz @ 12/7/2007 7:14:28 PM
RE: Vista Excel Compatibility w/ Worksheets Posted by Christopher Kemper @ 12/12/2007 6:00:07 PM
RE: Vista Excel Compatibility w/ Worksheets Posted by ade stilllearning @ 7/2/2009 8:16:02 AM
RE: Vista Excel Compatibility w/ Worksheets Posted by Jonathan Shay @ 7/8/2009 6:00:02 PM
RE: Vista Excel Compatibility w/ Worksheets Posted by Jonathan Shay @ 7/8/2009 3:15:19 PM
RE: Vista Excel Compatibility w/ Worksheets Posted by Cetin Basoz @ 7/8/2009 9:01:57 PM