Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. sponsors. rss.
 From: Anders Altberg
  Where is Anders Altberg?
 Uppsala
 Sweden
 Anders Altberg
 To: Patrick McGreevy
  Where is Patrick McGreevy?
 Clarksville
 Tennessee - United States
 Patrick McGreevy
 Tags
Subject: RE: Automation with Excel 2007
Thread ID: 164549 Message ID: 164636 # Views: 60 # Ratings: 1
Version: Visual FoxPro 9 SP2 Category: Microsoft Office Automation
Date: Wednesday, March 19, 2008 2:54:08 PM         
   


> >
> > Copy to ... type xl5
> >
> > wouldn't be affected. It creates an old version format which Excel 2007 recognizes.
> >
> > Your automation for decoration is unlikely to be affected any way. But there a question comes to mind. If you're using automation for decoration, why not use it for 'copy...' part too:) Then your document would be saved in Excel2007 format (currently I think you either suppress the prompts with DisplayAlerts=.f. or SaveAs).
> >
> > Cetin Basoz
> Cetin,
>
> Thanks, but no thanks. Everyone here is still running Office 2003.
>
> Pat


I'd recommend that you use automation and Excel's QueryTables function to read any type of DBF by way of VFPOLEDB:

Here'a and example turning the Orders.DBF in the Northwind.dbc into a spreadsheet you can then save as whatever XLS or XLSX format your customers support.

LOCAL oExcel AS Excel.APPLICATION
LOCAL oBook AS Excel.Workbook
LOCAL oSheet AS OBJECT
oExcel = CREATEOBJECT("Excel.Application")
oBook = oExcel.Workbooks.ADD
oSheet = oBook.Worksheets(1)

* 'Create the QueryTable object.
LOCAL oQryTable AS OBJECT, sNorthwind AS STRING
sNorthwind = HOME(2) +;
[NORTHWIND\NORTHWIND.DBC]
oQryTable = oSheet.QueryTables.ADD ;
("OLEDB;Provider=VFPOLEDB.1;Data Source="+sNorthwind+";", ;
oSheet.RANGE("A1"),"Select * from Orders")
oQryTable.RefreshStyle = 2 && xlInsertEntireRows = 2
oQryTable.REFRESH(.F.)
oExcel.VISIBLE=.T.


-Anders



COMPLETE THREAD
Automation with Excel 2007 Posted by Patrick McGreevy @ 3/19/2008 1:46:39 AM
RE: Automation with Excel 2007 Posted by Borislav Borissov @ 3/19/2008 8:47:43 AM
RE: Automation with Excel 2007 Posted by Patrick McGreevy @ 3/19/2008 2:36:16 PM
RE: Automation with Excel 2007 Posted by Cetin Basoz @ 3/19/2008 11:29:02 AM
RE: Automation with Excel 2007 Posted by Patrick McGreevy @ 3/19/2008 2:30:58 PM
RE: Automation with Excel 2007 Posted by Cetin Basoz @ 3/19/2008 2:38:01 PM
RE: Automation with Excel 2007 Posted by Patrick McGreevy @ 3/20/2008 6:35:13 PM
RE: Automation with Excel 2007 Posted by Anders Altberg @ 3/19/2008 2:54:08 PM
RE: Automation with Excel 2007 Posted by Patrick McGreevy @ 3/20/2008 6:50:18 PM
RE: Automation with Excel 2007 Posted by David Jo @ 8/5/2009 5:32:35 PM
RE: Automation with Excel 2007 Posted by Cetin Basoz @ 8/5/2009 6:51:13 PM
RE: Automation with Excel 2007 Posted by David Jo @ 8/5/2009 7:26:29 PM
RE: Automation with Excel 2007 Posted by Borislav Borissov @ 8/5/2009 8:07:00 PM
RE: Automation with Excel 2007 Posted by Anders Altberg @ 8/5/2009 9:45:50 PM