Information générale
Catégorie:
COM/DCOM et OLE Automation
Let us suppose you have something like this in VBA code:
With ActiveSheet.QueryTables.Add(Connection:= _
"ODBC;DSN=Text Files;DefaultDir=c:\;DriverId=27;FIL=text;MaxBufferSize=2048;PageTimeout=5;" _
, Destination:=Range("A1"))
.Sql = Array( _
"SELECT sundet.G01, sundet.NoName" & Chr(13) & "" & Chr(10) & "FROM sundet.txt sundet" _
)
....
In VFP try this instead:
ConnectionString="ODBC;DSN=Text Files;DefaultDir=c:\;DriverId=27;FIL=text;MaxBufferSize=2048;PageTimeout=5;"
sqlquery ="SELECT sundet.G01, sundet.NoName FROM sundet.txt"
ObjExcel.ActiveSheet.QueryTables.Add(;
ConnectionString,;
ObjExcel.ActiveSheet.Range("A1"),;
sqlquery).Refresh
.....
>I'm automating a data migration task in wich i'm exporting data from a txt file to an excel sheet.
>Excel has an object called querytable, wich has an array property called textfilecolumndatatypes; this property stores a value for each column in the source file.
>In fact, something like:
>Myarray = MyQuerytable.TexFileColumnDataTypes
>returns an array, but (here's my problem)
>
>MyQuerytable.TexFileColumnDataTypes = Myarrray
>
>is not a valid statement (syntax error).
>So invalid are these other approaches:
>MyQuerytable.TexFileColumnDataTypes = Myarrray(1)
>MyQuerytable.TexFileColumnDataTypes(1) = '1,1'
>MyQuerytable.TexFileColumnDataTypes = '1,1'
>...
>
>How do I get to put some values in this property?
>
>TIA
Précédent
Répondre
Voir le fil de ce thread
Voir le fil de ce thread à partir de ce message seulement
Voir tous les messages de ce thread
Voir tous les messages de ce thread à partir de ce message seulement