Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Can somebody please give a hand?
Message
 
 
À
06/03/2009 14:51:08
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP
Network:
Windows 2003 Server
Database:
MS SQL Server
Divers
Thread ID:
01386076
Message ID:
01386306
Vues:
76
Cetin,

Can I comment out this part
>  For ix=1 To Iif( !Empty(m.tcHeaders), ;
>      ALINES(aHeader, m.tcHeaders,1,','), ;
>      loRS.Fields.Count )
>    toRange.Offset(0,m.ix-1).Value = ;
>      Iif( !Empty(m.tcHeaders), ;
>      aHeader[m.ix], ;
>      Proper(loRS.Fields(m.ix-1).Name) )
>    toRange.Offset(0,m.ix-1).Font.Bold = .T.
>  Endfor
and change toRange.Offset(1,0).CopyFromRecordSet(loRS) && Copy data starting from headerrow + 1
to toRange.Offset(0,0).CopyFromRecordSet(loRS) && Copy data starting from headerrow + 1

Would it still work?



>
>Rand(-1)
>Select c.Company,;
>  c.Contact, ;
>  RTRIM(e.First_Name)+' '+Rtrim(e.Last_Name) As eName, ;
>  CAST(Chrtran(e.Notes,Chr(13),'') As m) As Notes ;
>  FROM (_samples+'data\customer') c, (_samples+'data\employee') e ;
>  INTO Cursor xx ;
>  nofilter
>
>loExcel = Createobject('Excel.Application')
>With loExcel
>  .Workbooks.Add()
>  .Visible =.T.
>  VFP2Excel('xx',.ActiveWorkbook.ActiveSheet.Range('A1'))
>  .ActiveWorkbook.ActiveSheet.Usedrange.Columns.Autofit
>Endwith
>
>*** Author: Cetin Basoz
>Function VFP2Excel
>  Lparameters tcCursorName, toRange, tcHeaders
>  tcCursorName = Iif(Empty(m.tcCursorName),Alias(),m.tcCursorName)
>  Local loConn As AdoDB.Connection, loRS As AdoDB.Recordset, ;
>    lcTemp, loError, lcError
>
>  lcTemp = Forcepath(Sys(2015) + '.dbf',Sys(2023))
>  Select (m.tcCursorName)
>  Copy To (m.lcTemp)
>  loConn = Createobject("Adodb.connection")
>  loConn.ConnectionString = "Provider=VFPOLEDB;Data Source=" + Sys(2023)
>  loConn.Open()
>  loRS = loConn.Execute("select * from " + Justfname(m.lcTemp))
>
>  toRange.Offset(1,0).CopyFromRecordSet(loRS)  && Copy data starting from headerrow + 1
>
>  For ix=1 To Iif( !Empty(m.tcHeaders), ;
>      ALINES(aHeader, m.tcHeaders,1,','), ;
>      loRS.Fields.Count )
>    toRange.Offset(0,m.ix-1).Value = ;
>      Iif( !Empty(m.tcHeaders), ;
>      aHeader[m.ix], ;
>      Proper(loRS.Fields(m.ix-1).Name) )
>    toRange.Offset(0,m.ix-1).Font.Bold = .T.
>  Endfor
>
>  loRS.Close
>  loConn.Close
>  Erase (m.lcTemp)
>Endfunc
>
Cetin
If it's not broken, fix it until it is.


My Blog
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform