Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

excel pivot table with XML data source

trial03

Technical User
Oct 9, 2011
10
MY
Dear all,

Previously I use the vfp table as the data source of the excel pivot table.

oExcel = CREATEOBJECT("excel.application")
oWorkBook = oExcel.workBooks.add()

oTargetSheet = oWorkBook.sheets.add()
oTargetRange = oTargetSheet.range(mRange)

oPivotCache = oWorkBook.pivotCaches.add(2) && External data

oPivotCache.connection = "OLEDB;Provider=vfpOleDb.1;data source = c:\erp"
oPivotCache.commandText = "SELECT * FROM tRepData"

oPivotTable = oPivotCache.createPivotTable(oTargetRange,"pivotTable")

oPivotTable.PivotFields("csName").orientation = 1&& row
oPivotTable.PivotFields("cusName").orientation = 1 && row
oPivotTable.PivotFields("days").orientation = 2 && column
oPivotTable.PivotFields("cntDays").orientation = 4 && data

but nowadays most of the users install 64bits of MsOffice causing compatibility issues with VFP 32bits.


Thinking to export vfp data to xml and make it as the data source of the excel pivot table. Any idea how to do it?


Thanks and regards,
 
cursortoxml()

If you're using an old VFP6 version: https://webconnection.west-wind.com/docs/_s8x02fe2w.htm
In an old version that you get from https://client-tools.west-wind.com/, look at the right side:
Older unsupported versions for:

OR simply output XML yourself, it's not rocket science to have XML tags, it's all just text and what ou need is STRTOFILE or even just FWRITE.
 
Last edited:

Part and Inventory Search

Sponsor

Back
Top