Microsoft Office Forums

Go Back   Microsoft Office Forums > Microsoft Word > Word VBA

Reply
 
LinkBack Thread Tools Display Modes
  #1  
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
  #2  
Old 02-22-2014, 08:56 AM
marksm33 marksm33 is offline Windows 7 64bit Office 2013
Novice
 
Join Date: Jan 2014
Posts: 12
marksm33 is on a distinguished road
Default Solved my own problem:)

Discovered a faulty line of code in the Userform that was pushing the error code.
Reply With Quote
Reply

Tags
5941, macro problem, userform

Thread Tools
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
strange grayed out line prevents copying or deletion after endnotes JerryL Word 1 02-09-2014 08:59 AM
Using excel to track video game collection - questions Slurpyga Excel 3 07-05-2012 05:48 PM
showing a userform after hiding jillapass Word VBA 0 05-31-2012 06:13 AM
Outlook 2010 problem (new member) Cullers Outlook 0 01-21-2011 10:18 AM
New Member with a problem davieG Outlook 0 06-03-2006 02:45 PM


All times are GMT -7. The time now is 06:40 PM.


Powered by vBulletin® Version 3.8.1
Copyright ©2000 - 2018, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
MSOfficeForums.com is not affiliated with Microsoft