It's a two step process
1. Add UF to Project
2. Add UF to UserForms collection to .Show
FWIW, I've found it more reliable to use the item number in the UserForms collection
Option Explicit Sub test() Dim ufPld As VBIDE.vbcomponent 'add to project Set ufPld = ThisWorkbook.VBProject.VBComponents.Add(vbext_ct_MSForm) 'add to userforms collection Debug.Print VBA.UserForms.Count VBA.UserForms.Add ufPld.Name Debug.Print VBA.UserForms.Count 'show using item number VBA.UserForms(VBA.UserForms.Count - 1).Show ' Zero based so need to subtract 1 End Sub




Reply With Quote
