Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Excel won't open VFP tables
Message
De
18/05/2006 19:33:22
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
À
18/05/2006 18:31:28
Information générale
Forum:
Visual FoxPro
Catégorie:
Autre
Divers
Thread ID:
01117509
Message ID:
01123443
Vues:
20
>>>>>It has bugged me for a long time that Excel does not offer the possibility to open VFP files directly. It does read dBase files, but to do that you must copy tables TYPE FOX2X.
>>>>>
>>>>>Has anybody mentioned this to MS before?
>>>>>
>>>>>Alex
>>>>
>>>>Alex,
>>>>Which version of Excel doesn't read VFP tables directly (VFPOLEDB is considered direct,no?).
>>>>Cetin
>>>
>>>Hi Cetin,
>>>
>>>I want to import a cursor that has long names into Excel. Can you explain how to do it using VFPOLEDB? I will be using automation and then saving it as a bonafide xls file.
>>>
>>>TIA,
>>>
>>>Alex
>>
>>
>>* Create a table with LNF fieldnames
>>* in a directory with an LNF path
>>Local lcLNFDir
>>lcLNFDir = "c:\An LNF path"
>>Md (m.lcLNFDir)
>>Create Database ( Addbs(m.lcLNFDir)+"myDatabase" )
>>Select cust_id As CustomerID, ;
>>  company As "ThisIsAnLNF_Company_Name_of_customer", ;
>>  contact As "ThisIsAnLNF_Contact_FirstName_and_LastName_of_customer", ;
>>  city, Region, country ;
>>  from (_samples+'Data\Customer') ;
>>  into Table ( Addbs(m.lcLNFDir)+"myLNFTable" ) ;
>>  database ( Addbs(m.lcLNFDir)+"myDatabase" )
>>Close Databases All
>>
>>* Send data to excel
>>* PS: This is one of the many ways
>>VFP2Excel(Addbs(m.lcLNFDir)+"myDatabase.dbc",;
>>  'select * from myLNFTable',;
>>  "ThisIsVFPData")
>>
>>Erase ( Addbs(m.lcLNFDir)+"*.*" )
>>Rd (m.lcLNFDir)
>>
>>Function VFP2Excel
>>  Lparameters tcDataSource, tcSQL, tcSheetName
>>  Local loConn As AdoDB.Connection, ;
>>    loRS As AdoDB.Recordset,;
>>    lcTempRs As String, ;
>>    lcTemp As String, ;
>>    oExcel As Excel.Application
>>
>>  lcTempRs = Sys(5)+Curdir()+Sys(2015)+'.rst'
>>  loConn = Createobject("Adodb.connection")
>>  loConn.ConnectionString = "Provider=VFPOLEDB;Data Source="+m.tcDataSource
>>  loConn.Open()
>>  loRS = loConn.Execute(m.tcSQL)
>>  loRS.Save(m.lcTempRs)
>>  loRS.Close
>>  loConn.Close
>>  loRS.Open(m.lcTempRs)
>>
>>  oExcel = Createobject("Excel.Application")
>>  With oExcel
>>    .WorkBooks.Add
>>    .Visible = .T.
>>    With .ActiveWorkBook.ActiveSheet
>>      .Name = m.tcSheetName
>>      .QueryTables.Add( loRS, .Range("A1")).Refresh()
>>    Endwith
>>  Endwith
>>  loRS.Close
>>  Erase (m.lcTempRs)
>>
Cetin
>
>
>Thank you for an excellent and very educational answer, Cetin. Though I haven't tested it yet it is what I was looking for.
>
>BTW I tried to give you three stars but because this thread is in Chatter I'm not allowed. Please consider this worth three symbolic stars.
>
>Alex

Oh sounds like you missed my signature:)
Cetin
Çetin Basöz

The way to Go
Flutter - For mobile, web and desktop.
World's most advanced open source relational database.
.Net for foxheads - Blog (main)
FoxSharp - Blog (mirror)
Welcome to FoxyClasses

LinqPad - C#,VB,F#,SQL,eSQL ... scratchpad
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform