Avatar of Murray Brown
Murray Brown
Flag for United Kingdom of Great Britain and Northern Ireland asked on

Access VBA List all control names on all forms in Excel

Hi

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

Thanks
Microsoft AccessVBA

Avatar of undefined
Last Comment
John Tsioumpris

8/22/2022 - Mon
Ryan Chong

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
        Next
        For Each Ctrl In Sheet.Shapes
            Debug.Print Sheet.Name & ": " & Ctrl.Name
        Next
    Next
End Function

Open in new window

Anders Ebro (Microsoft MVP)

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.
Murray Brown

ASKER
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
Experts Exchange has (a) saved my job multiple times, (b) saved me hours, days, and even weeks of work, and often (c) makes me look like a superhero! This place is MAGIC!
Walt Forbes
ASKER CERTIFIED SOLUTION
John Tsioumpris

THIS SOLUTION ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
GET A PERSONALIZED SOLUTION
Ask your own question & get feedback from real experts
Find out why thousands trust the EE community with their toughest problems.
Ryan Chong

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.
Murray Brown

ASKER
Great answer.Thanks again John
John Tsioumpris

Glad i could help Murray
⚡ FREE TRIAL OFFER
Try out a week of full access for free.
Find out why thousands trust the EE community with their toughest problems.