Hi,
From your description, it seems that you want to share a workbook with
macro code among a few users, so that every user can access the workbook
independently and run the macro code. Based on my test, it seems to be OK.
Here is my reproduce code.
[UserForm1]
Private Sub CommandButton1_Click()
Dim cn As New Connection
cn.ConnectionString = "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist
Security Info=False;Initial Catalog=Northwind;Data Source=<computer>"
cn.Open
Dim rs As New Recordset
rs.CursorLocation = adUseClient
rs.CursorType = adOpenDynamic
rs.Open "Select * from customers", cn
Sheet1.Cells(1, 1).Value = rs.RecordCount
rs.Close
cn.Close
End Sub
[Macro Test]
Sub Test()
UserForm1.Show vbModal
End Sub
1. I shared the workbook on machine A(e.g. \\A\test\test.xls)
2. user A on machine B open \\A\test\test.xls and run the macro test and
then click the button on the form
3. user B on machine C open \\A\test\test.xls and run the macro test and
then click the button on the form
All is OK.
If I have any misunderstanding, please feel free to let me know. You may
have a try or you may just post a reproduce code together with detailed
repro steps so that we can do further troubleshooting.
Also I have reviewed your another post "Limitations of shared workbooks",
it seems that the two ones are related, so I will follow you up here and
close that one first.
If you have any concern, please feel free to let me know.
Best regards,
Peter Huang
Microsoft Online Partner Support
Get Secure! -
www.microsoft.com/security
This posting is provided "AS IS" with no warranties, and confers no rights.