Losing reference to global dictionary from one userform to another

RawlinsCross

Active Member
Joined
Sep 9, 2016
Messages
437
Good day,

I have a userform in whose code module I make a dictionary. I've declared the dictionary as an global object in a separate module and by late-scripting set the dictionary inside the userform code module. (The idea being that I can use the dictionary throughout the application).

The only thing is that when I open a second userform and try to reference the dictionary made in the first userform, I lose the reference (i.e. dictionary = nothing).

Does anyone have any experience in this as to why the global object 'disappears'? Is it a late-binding thing? (i.e. would this not happen if I used early-binding?)
 

Excel Facts

Remove leading & trailing spaces
Save as CSV to remove all leading and trailing spaces. It is faster than using TRIM().
try to refer to it through the parent object e.g.:
VBA Code:
Userform1.dictionary
However the parent form must still be loaded. If it is unloaded this call will load it again and you will get a newly initialised dictionary.

Reading again maybe I misunderstood you. Is the dictionary defined in a code module? Can you post the relevant code?
 
Upvote 0
Hey there...

So yeah, the dictionary is formed inside the 1st userform, but is declared as a global variable in a Code Module outside the userform. But as soon as I try to reference the dictionary in a 2nd userform, it's not there! Is there a way to copy a small excel file to a reply? I can send a 'demonstration' excel file.
 
Upvote 0
Is there a way to copy a small excel file to a reply? I can send a 'demonstration' excel file.
You can upload the file to a cloud storage and post the link.
Or you can simply post the relevant codes.
 
Upvote 0

Forum statistics

Threads
1,214,833
Messages
6,121,868
Members
449,054
Latest member
juliecooper255

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