Forum Discussion

hrh_dash's avatar
hrh_dash
Iron Contributor
Jul 26, 2022
Solved

Save xlsm in another workbook as xlsx and remove all user form controls

Is there a way to save xlsm in another workbook as xlsx and remove all user form controls?   The code below work perfectly but I would like to remove the user form controls when saved in xlsx file ...
  • JKPieterse's avatar
    Jul 27, 2022

    hrh_dash Controls are shapes, so call this sub to remove them from the active worksheet:

    Sub RemoveControls()
        Dim shp As Shape
        For Each shp In ActiveSheet.Shapes
            If shp.Type = msoOLEControlObject Or shp.Type = msoFormControl Then
                shp.Delete
            End If
        Next
    End Sub
    

     

Resources