Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Excel, VFP and OLE DB
Message
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Titre:
Excel, VFP and OLE DB
Versions des environnements
Visual FoxPro:
VFP 9
Divers
Thread ID:
01386067
Message ID:
01386067
Vues:
123
I have some automation code that works with the ODBC driver, I am changing to the OLEDB driver and hitting a few problems.

This is the recorded macro from Excel:
With ActiveSheet.ListObjects.Add(SourceType:=0, Source:=Array( _
    "OLEDB;Provider=VFPOLEDB.1;Data Source=C:\DEMO\DEMO.DBC;Mode=Share Deny None;Extended Properties="""";User ID=" _
    , _
    """"";Mask Password=False;Cache Authentication=False;Encrypt Password=False;Collating Sequence=MACHINE;DSN=""""" _
    ), Destination:=Range("$A$1")).QueryTable
    .CommandType = xlCmdTable
    .CommandText = Array("`employees`")
    ...etc.

I have converted to VFP as follows:
loRange = loExcel.Range("A1") 
lcConnectionString = [Provider=VFPOLEDB.1;Data Source=C:\DEMO\DEMO.DBC;Mode=Share Deny None;Extended Properties="";User ID="";Mask Password=False;Cache Authentication=False;Encrypt Password=False;Collating Sequence=MACHINE;DSN=""]
loQueryTable = loExcel.ActiveSheet.ListObjects.Add(0, lcConnectionString, loRange)
loQueryTable.CommandType = 3 &&xlCmdTable
...etc.
It is failing on ListObjects.Add() call with the following error:
OLE error code 0x80070057: The parameter is incorrect.

I am using VFP 9 with the VFP 9 OLE DB Driver against Excel 2007.

Any pointers?
- Craig

"If you're not prepared to be wrong, you will never come up with anything original."
- Sir Ken Robinson
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform