Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Excel Automation - Data Query HowTo
Message
From
22/04/2003 14:35:52
 
 
To
All
General information
Forum:
Visual FoxPro
Category:
COM/DCOM and OLE Automation
Title:
Excel Automation - Data Query HowTo
Miscellaneous
Thread ID:
00780265
Message ID:
00780265
Views:
39
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
On a CLEAR day you can see forever.
Next
Reply
Map
View

Click here to load this message in the networking platform