ODBC Query
On Jan 21, 7:15*am, Alan wrote:
I am pulling data into Excel using ODBC. The returned data consists of
4 strings/numbers but, instead of being written to my defined
"results" range, the "system" is inserting 4 extra columns to the left
of my defined range for each and every iteration. Is there a way that
I can prevent this from happening such that the returned data
automatically gets written into the defined range?
Regards,
hi
you didn't really give enough info to tell what's really wrong.
posting your code would be very helpful.
but from what you did post, it sounds like you are trying to recreate
the query each time you run it. that is really not necessary. once the
query has been created, excel assigns a name to it, a named range and
gives it properties. after that all you need to do is refresh the
query table. and 1 line of code would do it.
assuming query table is on sheet1 at cell A1.
Sub refre****()
Sheets("sheet1").Range("A2").QueryTable.Refresh BackgroundQuery:=False
MsgBox "done"
End Sub
you could also right click the query table and from the popup, click
refresh.
so if i have it wrong, post the code you are using.
regards
FSt1
|