View Single Post
 
Old 02-20-2014, 02:29 PM
marksm33 marksm33 is offline Windows 7 64bit Office 2013
Novice
 
Join Date: Jan 2014
Posts: 12
marksm33 is on a distinguished road
Lightbulb 5941 requested member of collection does not exist Prevents Userform from Showing

I have two userforms in one project. One is called frm1a and the other is called frm1b. I am trying to insert controls into the word document that when double clicked, cause the appropriate userform to show. When I use the code below with two separate macro buttons, the first works perfectly. When I attempt to have the second userform (frm1b) to show, I get the error listed above. Both of the callfrm procedures are in the same module, I have tried to make it work by putting them in separate modules.

When I debug and hover over frm1b, it says "object variable or With block variable not set." Any ideas? I think it's really simple, staring me in the face and I just can't see it....

Code:
Option Explicit
Sub Callfrm1a()
Dim oFrm As frm1a
Set oFrm = New frm1a
  oFrm.Show
  Unload oFrm
  Set oFrm = Nothing
lbl_Exit:
   Exit Sub
End Sub
 
Sub Callfrm1b()
Dim oFrm As frm1b
Set oFrm = New frm1b
  oFrm.Show
  Unload oFrm
  Set oFrm = Nothing
lbl_Exit:
   Exit Sub
End Sub
Reply With Quote