Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Memo field to excel
Message
De
25/04/2007 04:34:11
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Titre:
Memo field to excel
Versions des environnements
Visual FoxPro:
VFP 9 SP1
OS:
Windows XP SP2
Network:
Windows 2003 Server
Database:
Visual FoxPro
Divers
Thread ID:
01219676
Message ID:
01219676
Vues:
68
Hi,
I'm trying using Cetin's code snippets(Message #1203277,below), which I altered a bit, to convert a cursor with a memo field into a spreadsheet but it won't work properly. While with the sample cursor(employee) it works smoothly, with my cursor the memo field doesn't appear in the excel sheet.

Any help would be appreciated.

Tamas
LOCAL oExcel,lcCursorName

Select CrsToExcel1

sheetNames1 = "Megye_eseti"

oExcel = Createobject("Excel.Application")
With oExcel
  .DisplayAlerts = .F.
  .Workbooks.Add
  .Visible = .T.
  With .ActiveWorkBook
      lcCursorName = 'crsToExcel1'
      .WorkSheets(1).Name = sheetNames1
      VFP2Excel(m.lcCursorName, .WorkSheets(1),"A1" )
    .WorkSheets(1).Activate
  Endwith
Endwith

Function VFP2Excel
  Lparameters tcCursorName, toSheet, tcTargetRange
  tcCursorName = Iif(Empty(m.tcCursorName),Alias(),m.tcCursorName)
  tcTargetRange = Iif(Empty(m.tcTargetRange),'A1',m.tcTargetRange)
  Local loConn As AdoDB.Connection, loRS As AdoDB.Recordset,;
    lcTempRs, lcTemp, oExcel
  lcTemp = Forcepath(Sys(2015)+'.dbf',Sys(2023))
  lcTempRs = Forcepath(Sys(2015)+'.rst',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 "+m.lcTemp)
  loRS.Save(m.lcTempRs)
  loRS.Close
  loConn.Close
  Erase (m.lcTemp)
  loRS.Open(m.lcTempRs)

  With toSheet
    .QueryTables.Add( loRS, .Range(m.tcTargetRange)).Refresh()
  Endwith
  loRS.Close
  Erase (m.lcTempRs)
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform