用户窗体和工作表显示在Excel 2010中可用,但在Excel 2016中不可用

我遇到了更新显示在其后面的工作表的问题。 我能够重现与链接的testing工作表的问题。 在Excel 2010中,代码按预期工作。 在2016年(我假设2013年)工作表显示只更新如果代码停止在debugging器中。 另外,在代码完成之后,用户窗体需要20-30秒的时间才能将控制权交还给用户,然后在用户窗体上的字段之间甚至需要花费5-10秒。

我将不胜感激任何指导如何使这个代码与新版本的Excel一起工作。

UserForm1图像

UserForm1代码

Private Sub CommandButton1_Click() Call DisplayBanner Debug.Print "End - Button 1" End Sub Private Sub CommandButton2_Click() Call ExitForm End Sub 

工作表图像

macros代码

 Private xmlDoc As Object, Flow As Object Sub OpenForm() 'RUN button on Home sheet Application.ScreenUpdating = False UserForm1.Show vbModal End Sub Sub DisplayBanner() 'UserForm1.Hide Call DoBeforeStuff Application.ScreenUpdating = True Cells(1, 6).Value = "Banner Text Here" If UserForm1("CheckBox1").Value Then Stop Application.ScreenUpdating = False Call DoAfterStuff Application.ScreenUpdating = True Cells(1, 6).Value = vbNullString If UserForm1("CheckBox1").Value Then Stop Application.ScreenUpdating = False If Not UserForm1.Visible Then UserForm1.Show Debug.Print "End - DisplayBanner" End Sub Sub ExitForm() UserForm1.Hide Application.EnableEvents = True End Sub Sub DoBeforeStuff() Set xmlDoc = CreateObject("MSXML2.DOMDocument") xmlDoc.async = False: xmlDoc.validateOnParse = False Application.Wait (Now + TimeValue("0:00:01")) exFilename = Application.GetOpenFilename("Get XML File (*.*),*.*", , _ "Select a XML file") If Not xmlDoc.Load(exFilename) Then Err.Raise xmlDoc.parseError.ErrorCode, , xmlDoc.parseError.reason End If End Sub Sub DoAfterStuff() Set Flow = xmlDoc.DocumentElement Set xParent = Flow.FirstChild p = 1 For Each xParent In Flow.ChildNodes ParentNode = xParent.nodeName Sheets("OtherSheet").[Table1].Cells(p, 1).Value = ParentNode c = 1 For Each xChild In xParent.ChildNodes nodeName = xChild.nodeName Sheets("OtherSheet").[Table1].Cells(p, c + 1).Value = nodeName c = c + 1 Next xChild p = p + 1 Debug.Print ParentNode & " - " & p Next xParent Set xmlDoc = Nothing End Sub