Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
Excel Automation - Data Query HowTo
Message
De
22/04/2003 14:48:35
 
 
À
22/04/2003 14:35:52
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Divers
Thread ID:
00780265
Message ID:
00780276
Vues:
13
maybe i am missing something here, but since you are already in vfp now, just open the table directly instead of a odbc connection, find your data, and then pass it to the excell object/cells.


>Can anybody help me understand how to 'translate' a piece of VB code recorded in Excel into VFP usable code? I have some experience with this, but not as complex as this...
>
>The code below is what I start with... I know that I lose the SUB statement, replace the continuation character (_) with the VFP (;) character, the & with the + etc., but I keep getting a "missing ending )" error.
>
>Where might I look for further guidance on this?
>
>Thanks in advance for any help!
>
>Andrew
>
>Sub QueryTable()
>'
>' QueryTable Macro
>' Macro recorded 22/04/2003 by Andrew Jennings
>'
>
>'
> With ActiveSheet.QueryTables.Add(Connection:= _
> "ODBC;DSN=Visual FoxPro Tables;UID=;PWD=;SourceDB=f:\data\tssimms;SourceType=DBF;Exclusive=No;BackgroundFetch=Yes;Collate=Machine;" _
> , Destination:=Range("A13"))
> .CommandText = Array( _
> "SELECT simhisn.line_no, simhisn.batch_no, simhisn.b_l, simhisn.pro_no" & Chr(13) & "" & Chr(10) & "FROM simhisn simhisn" & Chr(13) & "" & Chr(10) & "WHERE (simhisn.batch_no=$485)" & Chr(13) & "" & Chr(10) & "ORDER BY simhisn.line_no" _
> )
> .Name = "Query from Visual FoxPro Tables"
> .FieldNames = True
> .RowNumbers = False
> .FillAdjacentFormulas = False
> .PreserveFormatting = True
> .RefreshOnFileOpen = False
> .BackgroundQuery = True
> .RefreshStyle = xlInsertDeleteCells
> .SavePassword = True
> .SaveData = True
> .AdjustColumnWidth = True
> .RefreshPeriod = 0
> .PreserveColumnInfo = True
> .Refresh BackgroundQuery:=False
> End With
>End Sub
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform