Excel 2016 version 1811 (build 11029.20079 Click-to-Run) is crashing without error when the following code is called from a user's interaction with a UserForm. Thing is, it only crashes in THIS (main)
UserForm. If I add the container to any other UserForm it executes without any issue.
Private container As Object
'***************************************************************************
'Purpose: Create the container frame that holds the page title and preview image
'***************************************************************************
Private Sub createContainer()
Set container = main.pageThumbnails.Controls.add("Forms.Frame.1", name) ' Break here, continuing causes *CRASH*
With container
.Caption = ""
.height = containerHeight
.width = containerWidth
.Left = 12
.top = areaHeight
.BackColor = defaultBackColor
.BorderColor = defaultBorderColor
End With
With main.pageThumbnails
.ScrollHeight = areaHeight
End With
End Sub
Checking Windows Event Viewer gives me the following:
Faulting application name: EXCEL.EXE, version: 16.0.11029.20079, time stamp: 0x5bf4c8c3
Faulting module name: coml2.dll, version: 10.0.17134.407, time stamp: 0xaad4943a
Exception code: 0xc0000005
Fault offset: 0x0000000000016521
Faulting process id: 0x100788
Faulting application start time: 0x01d48cb0460efe6f
Faulting application path: C:\Program Files\Microsoft Office\root\Office16\EXCEL.EXE
Faulting module path: C:\WINDOWS\System32\coml2.dll
Report Id: 3ff6565e-7c37-4733-87fd-7e5ab12cba1f
Faulting package full name:
Faulting package-relative application ID:
Things I've tried:
container
as an MSForms.frame
instead of an Object
excel.exe /s
container
from Private to Public and referencing Me.container
main
form using a singleton module instead of main.thumbnails
main
form code-behind.xlsm
file, copied over all class, modules, and forms (except main
). Created main
from scratchCommandButton
to the frame (this worked...)thumbs
frame to a bunch of random lettersThroughout my searching I found other people with the same crash and error logs in Windows Event Viewer. None of those posts were using VBA as I was. I solved the issue by deleting the referenced Control main.pageThumbnails
and recreating it in the editor.
At this time I have no idea what caused the issue nor if this solution is permanent.
After continuing to struggle with this issue and not coming up with a final solution or even an explanation as to why it's happening I created a workaround.
Instead of adding a MSForms.Frame
object to the container I instead added the frame contents (an image and four labels) to the container and control their positioning via a Sub setTop
method.
At this moment I'm unsure of the performance impact but at least I'm able to continue working on additional functionality.