Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. google. articles. downloads. faq. members. weblogs. file info. rss.
 From: Anders Altberg
  Where is Anders Altberg?
 Uppsala
 Sweden
 Anders Altberg
 To: Cetin Basoz
  Where is Cetin Basoz?
 Izmir
 Turkey
 Cetin Basoz
 Tags
Subject: RE: tabel with memo to excel
Thread ID: 185659 Message ID: 186098 # Views: 28 # Ratings: 0
Version: Visual FoxPro 9 SP2 Category: General VFP Topics
Date: Sunday, July 27, 2008 3:01:37 PM         
   


> > This is an issue of the fruit of cooperation between MrsAnders Altberg and Yousfi, Benameur for the widespread conversion of a table with DBF memo fields or not to Excel.
> > I hope that one day appear in textbooks of VFP.
> >
> >
> > *convert any table with memo or not to excel
> > *Anders Altberg and Yousfi Benameur    Thursday 07/24/2008
> > 
> > afile=getfile('dbf')
> > af1=justfname(afile)
> > path=justpath(afile)
> > ***********************
> > 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, strData AS STRING
> >   strData = path                    
> >   xx= 'oSheet.QueryTables.ADD("OLEDB;Provider=VFPOLEDB.1;Data Source="+ strData+";", oSheet.RANGE("A1"),"Select * from '+af1+'")'
> >   oQryTable=evaluate(xx)
> >   oQryTable.RefreshStyle = 2 && xlInsertEntireRows = 2
> >   oQryTable.REFRESH(.F.)
> >   oExcel.VISIBLE=.T.
> > 

> > i hope one day this code figures in the visual foxpro books.
> > regards
> > yousfi Benameur
>
> Yousfi,
> A little warning. It is likely that this code would error on Office2007. I don't have Office2007 on this computer and can't test now. Test and if it does try removing refreshstyle and refresh().
> Warning 2: If you create excel file this way and save, then move to another computer (or change account to someone who doesn't have access to source) you'd have a long wait trying to open again.
>
> IMHO prefer CopyFromRecordSet(adoRS) method instead.
>
> Cetin Basoz

The program works happily with Office 2007 (Excel version 12).
There's no problems whatsoever opening a workbook that has saved the result of a QueryTables call. The data are saved in the workbook and the source isn't needed at all after that.

Tested with Excel 11 and Excel 12.
-Anders

COMPLETE THREAD

tabel with memo to excel Posted by Yousfi Benameur @ 7/24/2008 4:33:20 PM
RE: tabel with memo to excel Posted by surinder singh @ 7/24/2008 4:47:17 PM
RE: tabel with memo to excel Posted by Yousfi Benameur @ 7/24/2008 5:14:26 PM
RE: tabel with memo to excel Posted by Yuri Rubinov @ 7/24/2008 4:47:57 PM
RE: tabel with memo to excel Posted by Yousfi Benameur @ 7/24/2008 5:23:27 PM
RE: tabel with memo to excel Posted by Koen Piller @ 7/24/2008 7:45:39 PM
RE: tabel with memo to excel Posted by Yuri Rubinov @ 7/24/2008 10:02:21 PM
RE: tabel with memo to excel Posted by Yousfi Benameur @ 7/25/2008 10:08:22 AM
RE: tabel with memo to excel Posted by Yuri Rubinov @ 7/25/2008 2:28:21 PM
RE: tabel with memo to excel Posted by Yuri Rubinov @ 7/25/2008 3:04:26 PM
RE: tabel with memo to excel Posted by Cetin Basoz @ 7/24/2008 5:09:20 PM
RE: tabel with memo to excel Posted by Yousfi Benameur @ 7/25/2008 10:26:07 AM
RE: tabel with memo to excel Posted by Anders Altberg @ 7/24/2008 8:36:37 PM
RE: tabel with memo to excel Posted by Yousfi Benameur @ 7/25/2008 12:26:42 AM
RE: tabel with memo to excel Posted by Yousfi Benameur @ 7/24/2008 10:43:47 PM
RE: tabel with memo to excel Posted by Cetin Basoz @ 7/25/2008 12:24:23 PM
RE: tabel with memo to excel Posted by Yousfi Benameur @ 7/29/2008 2:18:57 AM
RE: tabel with memo to excel Posted by Cetin Basoz @ 7/29/2008 11:42:24 AM
RE: tabel with memo to excel Posted by Yousfi Benameur @ 7/25/2008 12:22:15 AM
RE: tabel with memo to excel Posted by Cetin Basoz @ 7/25/2008 12:29:03 PM
RE: tabel with memo to excel Posted by Anders Altberg @ 7/27/2008 3:01:37 PM
RE: tabel with memo to excel Posted by Cetin Basoz @ 7/28/2008 9:11:31 AM