View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Fredrik Wahlgren Fredrik Wahlgren is offline
external usenet poster
 
Posts: 339
Default Excel2002 - use sql statements?


"Ron" wrote in message
...
Hello,

Just checking if it is possible to define a range of data
in a sheet as a table for use with Sql Statements. Is
this doable?

Example: if I link an Excel sheet into an Access mdb I
can say "Insert Into Sheet1 Select * From Table1" where
table1 contains several rows of data which I can insert
directly into the linked sheet. But what I would like to
do is to take a range of data from an Excel Sheet and use
ADO command object to pass the data as a batch to an
Access mdb Table.

Pseudocode-----------------
cmd.CommandText = "Insert Into Table1 Select * From Sheet1"
or
cmd.CommandText = "Insert Into Table1 Select * From Rng1"
or (if Excel has a table object)
cmd.CommandText = "Insert Into Table1 Select * From
tblSheet1"

where (real pseudocode here)---------------
Dim tblSheet1 As Excel.Table
Set tblSheet1 = Rng1

Thanks


http://support.microsoft.com/kb/278973/EN-US/

/Fredrik