PC Review


Reply
Thread Tools Rate Thread

Code Fails to open UserForm

 
 
ryguy7272
Guest
Posts: n/a
 
      12th Dec 2008
I keep getting an error on a UserForm, named UserForm1. Microsoft Forms 2.0
is checked off as a Reference. The code is extremely simple:
Sub OpApp()
ActiveWindow.WindowState = xlMinimized
UserForm1.Show
End Sub

It keeps failing on this line:
UserForm1.Show

I’ve worked with hundreds of different UserForms before; I can’t figure it
out. Could the UserForm somehow get corrupted? This is the second time that
I’ve tried this; with a fresh UserForm. What could cause this kind of
behavior?

All code behind UserForm is commented out...
'Private Sub cmdNewPT_Click()
'Dim C As MSForms.Control
'For Each C In Me.Controls
'If TypeOf C Is MSForms.TextBox Then
'C.Text = ""
'End If
'Next C
'End Sub

Any thoughts?

Thanks,
Ryan---

--
RyGuy
 
Reply With Quote
 
 
 
 
Susan
Guest
Posts: n/a
 
      12th Dec 2008
Sub OpApp()
ActiveWindow.WindowState = xlMinimized
UserForm1.Show
End Sub

worked for me.....................
sorry!
susan


On Dec 12, 12:23*pm, ryguy7272 <ryguy7...@discussions.microsoft.com>
wrote:
> I keep getting an error on a UserForm, named UserForm1. *Microsoft Forms 2.0
> is checked off as a Reference. *The code is extremely simple:
> Sub OpApp()
> ActiveWindow.WindowState = xlMinimized
> UserForm1.Show
> End Sub
>
> It keeps failing on this line:
> UserForm1.Show
>
> I’ve worked with hundreds of different UserForms before; I can’t figure it
> out. *Could the UserForm somehow get corrupted? *This is the second time that
> I’ve tried this; with a fresh UserForm. *What could cause this kind of
> behavior?
>
> All code behind UserForm is commented out...
> 'Private Sub cmdNewPT_Click()
> 'Dim C As MSForms.Control
> 'For Each C In Me.Controls
> 'If TypeOf C Is MSForms.TextBox Then
> 'C.Text = ""
> 'End If
> 'Next C
> 'End Sub
>
> Any thoughts?
>
> Thanks,
> Ryan---
>
> --
> RyGuy


 
Reply With Quote
 
ryguy7272
Guest
Posts: n/a
 
      12th Dec 2008
Thanks for confirming Susan. I banged my head against the wall multiple
times. Then, I restarted my computer. Now it works fine! It must have been
the head banging that made it work...

--
RyGuy


"Susan" wrote:

> Sub OpApp()
> ActiveWindow.WindowState = xlMinimized
> UserForm1.Show
> End Sub
>
> worked for me.....................
> sorry!
> susan
>
>
> On Dec 12, 12:23 pm, ryguy7272 <ryguy7...@discussions.microsoft.com>
> wrote:
> > I keep getting an error on a UserForm, named UserForm1. Microsoft Forms 2.0
> > is checked off as a Reference. The code is extremely simple:
> > Sub OpApp()
> > ActiveWindow.WindowState = xlMinimized
> > UserForm1.Show
> > End Sub
> >
> > It keeps failing on this line:
> > UserForm1.Show
> >
> > I’ve worked with hundreds of different UserForms before; I can’t figure it
> > out. Could the UserForm somehow get corrupted? This is the second time that
> > I’ve tried this; with a fresh UserForm. What could cause this kind of
> > behavior?
> >
> > All code behind UserForm is commented out...
> > 'Private Sub cmdNewPT_Click()
> > 'Dim C As MSForms.Control
> > 'For Each C In Me.Controls
> > 'If TypeOf C Is MSForms.TextBox Then
> > 'C.Text = ""
> > 'End If
> > 'Next C
> > 'End Sub
> >
> > Any thoughts?
> >
> > Thanks,
> > Ryan---
> >
> > --
> > RyGuy

>
>

 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How do you make a userform open automatically when you open excel? Evan Microsoft Excel Worksheet Functions 1 11th Mar 2010 02:24 AM
scope of private function called from UserForm fails oscar.c.marin Microsoft Excel Programming 1 20th Oct 2008 04:48 AM
How to get variables from worksheet code to userform code Donny Microsoft Excel Programming 6 23rd Aug 2008 01:31 AM
Really strange!! Switch/Open code fails occasionaly?! Leanne M (Aussie) Microsoft Excel Programming 4 2nd May 2008 12:56 PM
workbooks.open function fails to open an existing excel file when used in ASP, but works in VB. shirdisanthosh@gmail.com Microsoft Excel Discussion 0 30th Dec 2005 08:28 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 02:01 PM.