As a scripting language used in Microsoft Office products, VBA is actually very powerful, thanks to the fact that it inherits many of the fine traditions of Visual Basic. For example, we can introduce classes in VBA projects like VB 6. library or ActiveX control. Of course, the components or controls you use in VB 6 can also be used in VBA, such as the date input component. VBA supports ADO, which also means that we can operate databases in VBA, including SQL Server, Access, etc. Because of this, you can try to write a VBA program in Excel to use Excel as a middleware for data synchronization. This middleware can be used to synchronize the data in the application and the background database, and do some processing in it. . It can be done! I have done such an example in a previous project, and we even synchronized data between SQL Server and Sharepoint List through Excel (I will introduce this in some subsequent chapters). ADO is also very powerful. We can execute Windows scripts in it. It is often used to manage AD of Windows Server, such as traversing accounts in AD, modifying accounts in AD in batches, etc. There is nothing surprising about this. Yes, you can use Notepad to write a vbs script on Windows, and then use it directly to manage AD on your server. Of course, based on security considerations, these require appropriate execution permissions. These tasks can also be completed through VBA, and in Excel you will find that sometimes it is very convenient, such as borrowing Excel's existing UI to display the data being operated; generating charts based on the queried data; using the functions provided by Excel to modify Data; ease of traversing and organizing data, etc... I'll give an example below. Add an ActiveX Button to a new Sheet and add the following code. Private Sub CommandButton1_Click() On Error Resume Next Const ADS_SCOPE_SUBTREE = 2 Set objConnection = CreateObject (ADODB.Connection) Set objCommand = CreateObject(ADODB.Command) objConnection.Provider = ADsDSOObject objConnection.Open Active Directory Provider Set objCommand.ActiveConnection = objConnection objCommand.Properties(Page Size) = 1000 objCommand.Properties(Searchscope) = ADS_SCOPE_SUBTREE objCommand.CommandText = _ SELECT Name FROM 'LDAP://dc=XXX,dc=com' WHERE objectCategory='user' 'search all users from the domn XXX Set objRecordSet = objCommand.Execute objRecordSet.MoveFirst Dim currCell As Range Set currCell = Range(A1) Do Until objRecordSet.EOF currCell.Value = objRecordSet.fields(Name).Value Set currCell = currCell.Offset(1, 0) objRecordSet.MoveNext Loop End Sub In the code, I used an imaginary domain name XXX. Readers can change it to a real domain name if they want to test. We used ADO to perform a user query on the specified domain, and output the names of all users in the domain to the first column of the current Sheet in Excel. Below is a partial screenshot of the output results. Regarding how to operate AD through scripts, readers can refer to Microsoft's official documentation. If permissions are allowed, slightly modify the above code, and you can completely modify the accounts in AD in batches. In view of the company's network environment, it is not convenient to test here. Readers can try it themselves if they have the conditions.