Get properties of userform

BartH

New Member
Joined
Jul 4, 2006
Messages
14
Hi all,

I am currently working on a number of Excel files that use userforms.
To help me understand what's going on, I want to be able to report all properties and their values for any specific user form in an open workbook.

This line works fine (a user form in ThisWorkbook):
VBA Code:
    Debug.Print frm_RenameLink.Name, frm_RenameLink.Caption
    'result:  frm_RenameLink              Rename Link in Windows Quick Access

but when I want to grab the properties of a user form in another (open) workbook,
VBA Code:
    Debug.Print Workbooks("BartAddin.xlam").VBProject.VBComponents("frm_Settings").Name
    ' result: frm_Settings
   
    Debug.Print Workbooks("BartAddin.xlam").VBProject.VBComponents("frm_Settings").Properties("Caption")
I get the "Object expected to be local" message.

How can I resolve this issue so I can read a property from an external user from?
 

Attachments

  • localProperties.png
    localProperties.png
    48.3 KB · Views: 19

Excel Facts

Fastest way to copy a worksheet?
Hold down the Ctrl key while dragging tab for Sheet1 to the right. Excel will make a copy of the worksheet.
Your syntax seems correct. In fact, I've tested it, and I can confirm that it does return the name and caption.

I'm assuming that you've enabled your add-in and, therefore, the workbook is open. And I'm assuming that both workbooks are opened in the same instance of Excel. Otherwise, a subscript out of range error would occur in both cases.
 
Upvote 0
Solution
Hi Dominic,

ThnX for your reply.

I have worked out the code into a mini-application which I uploaded here:
https://www.nedcom.nl/Test.zip

Indeed my code works fine there.

Now I went back to the original workbooks and code and much to my surprise, the code ran without a flaw.
So I have to presume something else was causing the problem (but I'll never know what).

So again: "have you restarted already" seems to have done the trick.

Grtz, Bart
 
Upvote 0

Forum statistics

Threads
1,223,885
Messages
6,175,179
Members
452,615
Latest member
bogeys2birdies

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top