PC Review


Reply
Thread Tools Rate Thread

Can't Display Userform

 
 
WLMPilot
Guest
Posts: n/a
 
      30th Jan 2008
Below is the code used to try and display userform, but I keep getting an
error.
Error = File Not Found. Runtime Error 361 - Can't unload or load this
object.

Any ideas?
Thanks,
Les

Private Sub CommandButton42_Click()
frmCompare.Show
End Sub

Below is the other code associated with userform. I am just starting to
write the code, so it is not complete, but what I have already written
"should" work.

Private Sub CommandButton1_Click()
Dim cmpcntcat, ccntcat, currmnth, cmpmnth As Integer 'NOTE: l
(lowercase "L") & c = last & current months
Dim curr_rng, comp_rng, Cell As Range
Dim lcat(50), ccat(50) As String
Dim os, k, ck As Integer
os = 62 '#Rows to offset to each month
currmnth = Month(Date)
For k = 1 To 12
If OptionButton & k.Value = True Then
cmpmnth = k
k = 12
End If
End Sub


Private Sub UserForm_Initialize()
Dim mnth(12) As String
mnth(1) = "January"
mnth(2) = "February"
mnth(3) = "March"
mnth(4) = "April"
mnth(5) = "May"
mnth(6) = "June"
mnth(7) = "July"
mnth(8) = "August"
mnth(9) = "September"
mnth(10) = "October"
mnth(11) = "November"
mnth(12) = "December"
Label1.Caption = "Current Month is" & mnth(Month(Date))
End Sub

 
Reply With Quote
 
 
 
 
JLGWhiz
Guest
Posts: n/a
 
      30th Jan 2008
Label1.Caption = "Current Month is" & mnth(Month(Date))

You previously defined mnth(12) as a variant array. If mnth(Month(Date))
does not equate to one of those twelve array values, ie - 1 thru 12 in
parentheses
then you should get a compile error which would throw the initialize event
into a tizzy. I would offer an alternative but I am not sure what format you
are looking for.

"WLMPilot" wrote:

> Below is the code used to try and display userform, but I keep getting an
> error.
> Error = File Not Found. Runtime Error 361 - Can't unload or load this
> object.
>
> Any ideas?
> Thanks,
> Les
>
> Private Sub CommandButton42_Click()
> frmCompare.Show
> End Sub
>
> Below is the other code associated with userform. I am just starting to
> write the code, so it is not complete, but what I have already written
> "should" work.
>
> Private Sub CommandButton1_Click()
> Dim cmpcntcat, ccntcat, currmnth, cmpmnth As Integer 'NOTE: l
> (lowercase "L") & c = last & current months
> Dim curr_rng, comp_rng, Cell As Range
> Dim lcat(50), ccat(50) As String
> Dim os, k, ck As Integer
> os = 62 '#Rows to offset to each month
> currmnth = Month(Date)
> For k = 1 To 12
> If OptionButton & k.Value = True Then
> cmpmnth = k
> k = 12
> End If
> End Sub
>
>
> Private Sub UserForm_Initialize()
> Dim mnth(12) As String
> mnth(1) = "January"
> mnth(2) = "February"
> mnth(3) = "March"
> mnth(4) = "April"
> mnth(5) = "May"
> mnth(6) = "June"
> mnth(7) = "July"
> mnth(8) = "August"
> mnth(9) = "September"
> mnth(10) = "October"
> mnth(11) = "November"
> mnth(12) = "December"
> Label1.Caption = "Current Month is" & mnth(Month(Date))
> End Sub
>

 
Reply With Quote
 
WoWTCGDeckBuilder@gmail.com
Guest
Posts: n/a
 
      30th Jan 2008
On Jan 30, 2:09*pm, WLMPilot <WLMPi...@discussions.microsoft.com>
wrote:
> Below is the code used to try and display userform, but I keep getting an
> error.
> Error = File Not Found. * Runtime Error 361 - Can't unload or load this
> object.
>
> Any ideas?
> Thanks,
> Les
>
> Private Sub CommandButton42_Click()
> * frmCompare.Show
> End Sub
>
> Below is the other code associated with userform. *I am just starting to
> write the code, so it is not complete, but what I have already written
> "should" work.
>
> Private Sub CommandButton1_Click()
> * *Dim cmpcntcat, ccntcat, currmnth, cmpmnth As Integer * *'NOTE: *l
> (lowercase "L") & c = last & current months
> * *Dim curr_rng, comp_rng, Cell As Range
> * *Dim lcat(50), ccat(50) As String
> * *Dim os, k, ck As Integer
> * *os = 62 * * '#Rows to offset to each month
> * *currmnth = Month(Date)
> * *For k = 1 To 12
> * * * *If OptionButton & k.Value = True Then
> * * * * * * *cmpmnth = k
> * * * * * * *k = 12
> * * * *End If
> End Sub
>
> Private Sub UserForm_Initialize()
> * *Dim mnth(12) As String
> * *mnth(1) = "January"
> * *mnth(2) = "February"
> * *mnth(3) = "March"
> * *mnth(4) = "April"
> * *mnth(5) = "May"
> * *mnth(6) = "June"
> * *mnth(7) = "July"
> * *mnth(8) = "August"
> * *mnth(9) = "September"
> * *mnth(10) = "October"
> * *mnth(11) = "November"
> * *mnth(12) = "December"
> * *Label1.Caption = "Current Month is" & mnth(Month(Date))
> End Sub


Are you using 'Option Base 1' at the top of your code? If not, you
will need to declare your variable 'mnth(12)' as Dim mnth(1 to 12) as
string or change it to mnth(11) since 0 will be counted.
 
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
Userform to size to display =?Utf-8?B?SmFzb24gVg==?= Microsoft Excel Programming 2 17th Aug 2007 02:06 AM
display userform =?Utf-8?B?QW50aG9ueQ==?= Microsoft Excel Misc 3 27th Feb 2007 04:02 PM
Display AutoShape in UserForm bforster1 Microsoft Excel Programming 1 3rd Nov 2005 02:09 PM
Display an Userform =?Utf-8?B?SmVmZg==?= Microsoft Excel Misc 6 5th Nov 2004 04:13 PM
How to cause userform to display Jim Microsoft Excel Programming 4 28th Nov 2003 11:00 PM


Features
 

Advertising
 

Newsgroups
 


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