Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Excel 2007 Pivot Table
Message
De
24/05/2007 17:04:13
Cetin Basoz
Engineerica Inc.
Izmir, Turquie
 
 
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
01227554
Message ID:
01228338
Vues:
17
>>>>>The following code works great in earlier versions of Excel but 2007 changes things.
>>>>>this line just hangs
>>>>> oPivotTable = oPivotCache.CreatePivotTable( oTargetRange, "PivotTable" )
>>>>>Does anyone know if Tamar has released anything new on her wonderful "Office Automation Book"
>>>>
>>>>Andrew,
>>>>That CreatePivotTable syntax works perfectly well under Excel2007. I think the problem is in elsewhere. Probably you didn't only change the excel version.
>>>>Cetin
>>>Thanks Cetin
>>>This is a new Vista machine and it looks like I have problems with the ODBC driver for VFP
>>>When I try to set up the Visual Foxpro Drivers it tells me to go to msdn.microsoft.com/vfoxpro/downloads and get the latest ODBC which i have done and run but I am now in an endless loop where it keeps refering me to the web site for the latest ODBC for VFP - this is VFP9 SP1 - any pointers in this area - its very frustrating.
>>>regards
>>
>>Andrew,
>>Do not use ODBC driver. Last one was released with MDAC 2.5 or 2.6 and is not compatible with VFP9. Use VFPOLEDB driver instead.
>>Cetin
>Many thanks Cetin for you continued help. Here is the code that has been working for ages and i have downloaded the VFPOLEDB from the VFP site and applied it to Vista. Here is the code - could you suggest any alterations.
> md = left(goapp.netdrive,3)+'NIS\'
>    lp=";SourceType=DBF;Exclusive=No;BackgroundFetch=Yes;Collate=Machine;"
>    fp = "ODBC;DSN=Visual FoxPro Tables;UID=;PWD=;SourceDB="
>    fp = fp+md+lp
>    otargetsheet = oxl.sheets.add()
>    otargetsheet.name = "PIV"
>    otargetrange = otargetsheet.range("A2")
>    opivotcache = oxl.activeworkbook.pivotcaches.add( 2 ) && external data
>    opivotcache.connection = fp
>    opivotcache.commandtext = "select * from pivTable"
>    opivottable = opivotcache.createpivottable( otargetrange, "PivotTable" )
>thanks - regards

Would you try:
*** Constant Group: XlCmdType
#Define xlCmdCube                                         1
#Define xlCmdSQL                                          2
#Define xlCmdTable                                        3
#Define xlCmdDefault                                      4

md = Left(goapp.netdrive,3)+'NIS\'
otargetsheet = oxl.sheets.Add()
otargetsheet.Name = "PIV"
otargetrange = otargetsheet.Range("A2")
With oxl.ActiveWorkbook.PivotCaches.Add( 2 ) && xlExternal
  .Connection  = "OLEDB;Provider=VFPOLEDB;Data Source="+m.md
  .CommandType = xlCmdSQL
  .CommandText = "select * from pivTable"
  .CreatePivotTable(m.otargetrange, "PivotTable")
Endwith
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform