poopiebear
New Member
- Joined
- Nov 19, 2010
- Messages
- 41
I am attempting to do the following: Import 5 UserForms, then show UserForm2 when clicking the CommandButton.
UserForm2 will show if I have already have the user forms in my project, but when I import them, I get this object required error.
Thanks for the help!
UserForm2 will show if I have already have the user forms in my project, but when I import them, I get this object required error.
Code:
[COLOR=black][FONT=Verdana]Private Sub CommandButton1_Click()<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p>[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]<o:p> </o:p>[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]'Import UserForms for data entry
Application.VBE.ActiveVBProject.VBComponents.Import "C:\UserForm2.frm"
Application.VBE.ActiveVBProject.VBComponents.Import "C:\UserForm3.frm"
Application.VBE.ActiveVBProject.VBComponents.Import "C:\UserForm4.frm"
Application.VBE.ActiveVBProject.VBComponents.Import "C:\UserForm5.frm"
Application.VBE.ActiveVBProject.VBComponents.Import "C:\UserForm6.frm"<o:p></o:p>[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]<o:p> </o:p>[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]'Surname
If TextBox8.Text <> "" Then
Sheet5.Range("D8") = TextBox8.Text
Else
Sheet5.Range("D8") = ""
End If<o:p></o:p>[/FONT][/COLOR]
[COLOR=black][FONT=Verdana] <o:p></o:p>[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]'First Name
If TextBox9.Text <> "" Then
Sheet5.Range("D9") = TextBox9.Text
Else
Sheet5.Range("D9") = ""
End If<o:p></o:p>[/FONT][/COLOR]
[COLOR=black][FONT=Verdana] <o:p></o:p>[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]'Bunch of other stuff here....<o:p></o:p>[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]<o:p> </o:p>[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]'Display UserForm<o:p></o:p>[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]UserForm2.Show <o:p></o:p>[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]<o:p> </o:p>[/FONT][/COLOR]
[COLOR=black][FONT=Verdana]End Sub<o:p></o:p>[/FONT][/COLOR]
Thanks for the help!