Linking two workbooks
In my view,Access is more suitable to store your information.
And with ADO,we can easily upload data from Excel to Access.
the following is an example.
================================================== ================================================== ============
Sub ExcelToAccessViaADO()
Dim cnn As ADODB.Connection
Dim rst As ADODB.Recordset
Set cnn = New ADODB.Connection
Set rst = New ADODB.Recordset
Dim path, databasepsw As String
path = "d:\test.mdb"
databasepsw = "yourpassword" ' the database's password
cnn.Open "provider=Microsoft.Jet.OLEDB.4.0;data source=" & path & ";Jet
OLEDB:Database Password =" & databasepsw
rst.Open "dataTable", cnn, adOpenKeyset, adLockOptimistic, adCmdTable
'the "dataTable" is the table in Access
With rst
.AddNew
.Fields("Item1").Value = Cells(2, 37)
.Fields("Item2").Value = Cells(2, 38)
.Update
End With
rst.Close
Set rst = Nothing
cnn.Close
Set cnn = Nothing
End Sub
================================================== ================================================== ==========
"Bruise" <mkrupiarzATshaw.ca bl...
I am trying to link two workbooks. The source book has all the information
entered and stored. The other workbook will only be used by a limited
number of people to access designated information from the source workbook.
My problem is that the source workbook is password protected. When I open
the second workbook, I want it to update the information, but it asks for a
password to retrieve the information.
How would I set up a VBA code to automatically update the second workbook
with the source workbook and automatically enter the password so the user
doesn't need to know the password.
Does this make sense?
Help!!
Mark
|