Error: first it says the table already exists. so it I remove the tab then it says the table can not be found. So what am I doing wrong here? Can I Insert records from one Tab to another using this in Excel, or, not?
We have 1500 rows and 30 columns and I just need teh following columns copied into a new sheet. so I thought this would be quick and easy?
DougP
We have 1500 rows and 30 columns and I just need teh following columns copied into a new sheet. so I thought this would be quick and easy?
Code:
Dim cn As ADODB.Connection
Dim rs As ADODB.Recordset
Set cn = New ADODB.Connection
Set rs = New ADODB.Recordset
With cn
.Provider = "Microsoft.Jet.OLEDB.4.0"
.ConnectionString = "Data Source=" & WorkbookDestination & ";" & _
"Extended Properties=Excel 8.0;"
.CursorLocation = adUseClient
.Open
End With
Dim SQLInsert As String
SQLInsert = "SELECT [Webtime/Pace Name], " & _
"EID, " & _
"[LDAP Full Name], " & _
"[First Name], " & _
"[Last Name], " & _
"[Type2], " & _
"[LDAP Manager], " & _
"[Report 1], " & _
"[Report 2], " & _
"[Report 3], " & _
"[Report 4] " & _
"INTO [Sheet1$] " & _
"FROM [Base$];"
rs.Open SQLInsert, cn
DougP