Excel用户窗体冻结初始化

时间:2019-05-05 19:29:03

标签: excel vba initialization userform

更新:我删除了语句Me.multipage_new_plan.value = 0,现在该过程按预期工作。但是,这还需要在VBA编辑器中手动设置多页控件的.value属性。我仍然很好奇为什么此语句在一个版本的excel中而不是另一个版本中导致问题?


我正在寻找有关为什么正确初始化并在Excel 2016 for Office 365(16.0.10730.20264)32位中显示的用户窗体将冻结整个Excel程序在Excel 2016中初始化过程的最后一行的想法( 16.0.4738.1000)32位。

我可以逐步执行初始化过程,直到语句Me.multipage_new_plan.value = 0,然后Excel在16.0.4738版本中冻结。

Option Explicit

Private Sub UserForm_Initialize()
      Dim i As Double

      ' Set the options for the aircraft number and quarters combox boxes
      For i = 1 To 15
            Me.cb_quarters.AddItem i
            If i > 2 Then Me.cb_acft_number.AddItem i
      Next i

      ' Set the currentplan and status sheet name combo boxes
      Me.cb_current_plan_name.Clear
      Me.cb_current_status_sheet.Clear

      For i = 1 To Sheets.Count
            Me.cb_current_plan_name.AddItem Sheets(i).Name
            Me.cb_current_status_sheet.AddItem Sheets(i).Name
      Next

      update_btn = False
      Me.cb_acft_number.ListIndex = 3 

      ' Correct for border size calculations bug in Excel 2016
      Me.Height = 510
      Me.Width = 800
      Me.Caption = NEW_PLAN_FORM_TITLE
      Me.multipage_new_plan.value = 0 ' <--- freezes on or after this line
End Sub ' <--- cannot step to this line in break mode

对这里的罪魁祸首有何想法?

0 个答案:

没有答案