I've found the below code which I think is inteded for microsoft visual studio. What I'm wondering is can it be changed to work from XL. If so I will be useing one workbook with the code and a userform to read/write data to the closed workbook as a database!
Sub Link()
Dim adoCn
Dim adoRs
Set adoCn = CreateObject("ADODB.Connection")
With adoCn
.Provider = "Microsoft.Jet.OLEDB.4.0"
.ConnectionString = _
"Data Source=C:\Island.xls;" & _
"Extended Properties=Excell 8.0;"
End With
Set adoRs = CreateObject("ADODB.Recordset")
strQuery = "SELECT * FROM [Sheet2$]"
With adoRs
Set .ActiveConnection = adoCn
.Open strQuery
End With
End Sub
I've already seen the examples which open one workbook and copy the data over but you may as well just include the data in the original workbook!
Thanks in advance
Ryan A UK
Sub Link()
Dim adoCn
Dim adoRs
Set adoCn = CreateObject("ADODB.Connection")
With adoCn
.Provider = "Microsoft.Jet.OLEDB.4.0"
.ConnectionString = _
"Data Source=C:\Island.xls;" & _
"Extended Properties=Excell 8.0;"
End With
Set adoRs = CreateObject("ADODB.Recordset")
strQuery = "SELECT * FROM [Sheet2$]"
With adoRs
Set .ActiveConnection = adoCn
.Open strQuery
End With
End Sub
I've already seen the examples which open one workbook and copy the data over but you may as well just include the data in the original workbook!
Thanks in advance
Ryan A UK