Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Excel, VFP and OLE DB
Message
 
 
To
05/03/2009 21:23:42
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Environment versions
Visual FoxPro:
VFP 9
Miscellaneous
Thread ID:
01386067
Message ID:
01386068
Views:
52
Check Export or Copy TO Excel and Date Formatting Message #1383471

>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?
--sb--
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform