Link to home
Start Free TrialLog in
Avatar of Murray Brown
Murray BrownFlag for United Kingdom of Great Britain and Northern Ireland

asked on

Access VBA List all control names on all forms in Excel


What Access VBA code would I use to generate a list of all the control names on all forms in Access and export this list to Excel

Avatar of Ryan Chong
Ryan Chong
Flag of Singapore image

probably you could try like this:

Function test()
    Dim Sheet As Worksheet, Ctrl As Object
    For Each Sheet In Worksheets
        For Each Ctrl In Sheet.OLEObjects
            Debug.Print Sheet.Name & ": " & Ctrl.Name
        For Each Ctrl In Sheet.Shapes
            Debug.Print Sheet.Name & ": " & Ctrl.Name
End Function

Open in new window

Are you trying to export a list of ACCESS form controls to an excel spreadsheet?
Or are you trying to list EXCEL userform controls in excel, but doing it from access?

I'm confused about your question, as both excel and Access have userforms and controls.
Avatar of Murray Brown


Hi Anders. Yes to your first question "Are you trying to export a list of ACCESS form controls to an excel spreadsheet? "
My original question was badly worded
Avatar of John Tsioumpris
John Tsioumpris
Flag of Greece image

Link to home
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Agreed with John and think the form need to be opened in order to read its controls. So far, I can't find any alternative ways can do that.
Great answer.Thanks again John
Glad i could help Murray