I get the above 'object required' error when I use the above component
import method. The code is below:
Sub ImportForm(ThisForm, ShowIt, IsImported)
'loads form. shows form if ShowIt=TRUE
Dim WhichKey As String
'
'FYI ThisForm As String, ShowIt and IsImported As Boolean
'
IsImported = False 'default
'pref file open to get values to fill in form?
Call IsFileOpen(UserPref_fname, IsOpen)
If Not IsOpen Then
WhichKey = "UserPref"
Call RestoreGlobalFileName(WhichKey, Restored, FName)
If Not Restored Then Exit Sub
End If
ThisWorkbook.Activate
ChDir ThisWorkbook.Path
'already imported?
If Not VBComponentLoaded(ThisForm) Then
'does it exist?
If IsFileInPath(ThisForm & ".frm") Then
Application.VBE.ActiveVBProject.VBComponents.Import _
(ThisForm & ".frm")
IsImported = True
Else
IsImported = False
UserErrorNum = 6 & "*" & ThisForm & ".frm"
Call UserErrors(UserErrorNum)
Exit Sub
End If
Else
IsImported = True
End If
If ShowIt Then VBA.UserForms.Add(ThisForm).Show
End Sub
The macro stops after
Application.VBE.ActiveVBProject.VBComponents.Import , giving the
run-time error. The form is nonetheless imported. The system is
Windows98 and Xl97
There appears to be a lot of info on this topic, but as far as I can
tell, I've got the correct code for importing the component.