Issue description: The target PC has both Office 2010 and 2016 installed, after uninstalled the Office 2016, and open an Excel Spreadsheet, the above error happened. Fix: Go to below folder: C:\Program Files\Common Files\Microsoft Shared\VBA\VBA6 Rename the file "VBE6EXT.OLB" to "VBE6EXT.OLD”. Open Excel again, click Alt+F11, a popup window prompting for repairing, click "Yes". After repair completed, the problem is fixed also.
I encounter this issue in VS2017, it shall apply to older version also. To repeat the issue: 1. Create a PreBuildEvent, and type below script echo TargetDir = "$(TargetDir)" 2. Build the project, you will see: TargetDir = "" Solution: Open the project file with a text editor, then remove the PreBuildEvent section, including the outer <PropertyGroup>. Then re-add the Pre Build Events using Visual Studio. <PropertyGroup> <PreBuildEvent> <!-- Pre build commands go here --> </PreBuildEvent> </PropertyGroup>
VBA codes showing the list of users who open the shared workbook: ThisWorkbook: Private Sub Workbook_Open() Application.OnKey "{F2}", "UsersInfo" UsersInfo End Sub Module1: Public Sub UsersInfo() Users = ActiveWorkbook.UserStatus Dim sMsg As String Dim nLen1 As Integer Dim nLen2 As Integer nLen1 = 0 nLen2 = 0 For Row = 1 To UBound(Users, 1) If Len(Users(Row, 1)) > nLen1 Then nLen1 = Len(Users(Row, 1)) End If If Len(Users(Row, 2)) > nLen2 Then nLen2 = Len(Users(Row, 2)) End If ...
Comments
Post a Comment