Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Convert to excel
Message
From
03/02/2007 08:17:57
Cetin Basoz
Engineerica Inc.
Izmir, Turkey
 
 
To
03/02/2007 01:51:49
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Environment versions
Visual FoxPro:
VFP 9 SP1
Miscellaneous
Thread ID:
01191289
Message ID:
01192097
Views:
14
Yes it's for excel only. For others you can write other type of handlers.
Cetin

>Dear Mr.Cetin,
>thank you for reply , this is Wonderfull code,
>but, as you know this code convert form vfp tables to excel sheet,
>
>i think via this code i can convert from any type as aa.pdf,aa.html,aa.ptf,aa.postscript,aa.text,or aa.xml ,
>
>but i have no idea how i can do that,
>is there a way(example) to use it as ..
>
>thisform.text1.value=GETFILE(AS aa.ptf OR  aa.xml      ) from any dir
>
>via command button
>sheetNames[1] = "any name"&&
>
>
>oExcel = Createobject("Excel.Application")
>With oExcel
>  .DisplayAlerts = .F.
>  .Workbooks.Add
>  .Visible = .T.
>  With .ActiveWorkBook
>    For ix = 1 To 1&&
>      lcCursorName = 'crsToExcel'+Ltrim(Str(m.ix))
>      If .sheets.Count < m.ix
>        .sheets.Add(,.sheets(.sheets.Count)) && Add new sheet
>      ENDIF
>      .WorkSheets(m.ix).Name = sheetNames[m.ix]
>      VFP2Excel(m.lcCursorName, .WorkSheets(m.ix),"A1" )
>    ENDFOR
>    .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)
>
>
>
>thank you
>
>>>hi all,
>>>
>>>i have oracle seystem ,via this system, oracle code(command button), i can convert the data i choice to
>>>pdf,html,ptf,postscript,text,xml.
>>>is ther away to convert any of them to excel sheet via vfp code.
>>>
>>>thanks alot.
>>
>>Re: How to copy a cursor to a spreadsheet Thread #1175581 Message #1175601
>>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
Previous
Reply
Map
View

Click here to load this message in the networking platform