File tree Expand file tree Collapse file tree 1 file changed +13
-1
lines changed
Rubberduck.Parsing/Symbols Expand file tree Collapse file tree 1 file changed +13
-1
lines changed Original file line number Diff line number Diff line change @@ -134,9 +134,21 @@ private void DeclareControlsAsMembers(IVBComponent form)
134
134
{
135
135
if ( form . Controls == null ) { return ; }
136
136
137
+ var libraryQualifier = string . Empty ;
138
+ if ( form . ComponentType == ComponentType . UserForm )
139
+ {
140
+ var msFormsLib = _state . DeclarationFinder . FindProject ( "MSForms" ) ;
141
+ //Debug.Assert(msFormsLib != null);
142
+ if ( msFormsLib != null )
143
+ {
144
+ // given a UserForm component, MSForms reference is in use and cannot be removed.
145
+ libraryQualifier = "MSForms." ;
146
+ }
147
+ }
148
+
137
149
foreach ( var control in form . Controls )
138
150
{
139
- var typeName = $ "MSForms. { control . TypeName ( ) } ";
151
+ var typeName = $ "{ libraryQualifier } { control . TypeName ( ) } ";
140
152
// The as type declaration should be TextBox, CheckBox, etc. depending on the type.
141
153
var declaration = new Declaration (
142
154
_qualifiedModuleName . QualifyMemberName ( control . Name ) ,
You can’t perform that action at this time.
0 commit comments