I am new to this forum. Please bear with me.
I have been working on a project in which I plan to have a worksheet that contains a userform and some activeX controls. The activeX controls are on the worksheet. I have duplicated the problem I'm facing with the script below. When subroutine finishes, the userform is not visible on the screen. If I comment-out the lines pertaining to the OLEObject, then I can see the userform as modeless on the screen. The question is, is this behavior expected? Why does the userform fail to be visible when there are activeX on the worksheet?
Sub DemoFailure()
Dim myOleObj As OLEObject
Dim myRng As Range
Set myRng = ThisWorkbook.Sheets("Sheet1").Range("C4")
ThisWorkbook.Sheets("Sheet1").Select
ThisWorkbook.Sheets("Sheet1").Activate
With ActiveSheet
myRng.RowHeight = 20
Set myOleObj = .OLEObjects.Add(ClassType:="Forms.CheckBox.1", DisplayAsIcon:=False, Left:=myRng.Left + 2, Top:=myRng.Top + 2, Width:=myRng.Width - 4, Height:=myRng.Height - 4)
With myOleObj
'.Object.Caption =
.Name = "CheckBox" & CStr(ii)
End With
End With
UserForm1.Show vbModeless
End Sub
This code works for me (assuming "UserForm1" exists in the same module). This is a very rough recreation of your code, because I don't know from your question exactly what you are trying to achieve other than to get the box and Form to display at the same time: