How I rename a Userform by Code? RRS feed

  • Question

  • Hi @ all

    I can't find a solution. Maybe someone can help me. Thanks

    Sub frm_RefDesSelection() is activate Bibliothek Microsoft Forms 2.0 Object Library
    Dim objUserForm As Object
    Dim objVBProj As VBIDE.VBProject         'Verweis Microsoft Visual Basic for Applications Extensibility aktivieren.
    Dim objVBComp As VBIDE.VBComponent
    Dim objCodeMod As VBIDE.CodeModule
    Dim lst_RefDes As MSForms.ListBox
    Dim cmb_Close As MSForms.CommandButton
    Dim lbl_SelectIC As MSForms.Label
    Dim strFRMName As String
    Dim strDummyFRMName As String
    Dim intRow As Integer
    Dim i As Integer
    strFRMName = "frm_XYZ"
    Set objVBComp = ActiveWorkbook.VBProject.VBComponents.Add(vbext_ct_MSForm)
    ' Eigenschaften von UserForm ändern
        With objVBComp
            .Properties("Caption") = "IC Component Selection"
            .Properties("Width") = 300
            .Properties("Height") = 350
             strDummyFRMName = .Properties("Name")
             objVBComp.Designer(strDummyFRMName).Name = strFRMName ' <-- here is the problem
        End With
    end sub

    Wednesday, January 1, 2014 2:03 PM


  • Hi Ferby,

    Since the issue is more related to the feature of VBA, I am moving your thread into the Visual Basic for Applications (VBA) Forum for dedicated support. Thanks for your understanding.

    Best Regards,

    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Marked as answer by Ferby_ Thursday, April 9, 2015 1:23 PM
    Thursday, January 2, 2014 8:52 AM