View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Per Jessen[_2_] Per Jessen[_2_] is offline
external usenet poster
 
Posts: 703
Default Userform Error 91 and 438

Hi

Summary is a used property in excel, so you shouldn't use it as a
userform name. Change the userform name and it should work.

I am not sure about the GetTitle userform (it is at least not used in
excel 2000), but it won't hurt to change this name too.

Hopes this helps.
....
Per

On 30 Jun., 21:36, Bishop wrote:
I have the following code:

Option Explicit

Sub ControlForms(varCode)

If Chr(varCode) = "A" Then
Unload AddOrFind
AddTitle.Show
ElseIf Chr(varCode) = "F" Then
Unload AddOrFind
GetTitle.Show
ElseIf Chr(varCode) = "V" Then
Unload AddOrFind
Summary.Show
End If

End Sub

Private Sub AddButton_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, _
ByVal Shift As Integer)
ControlForms KeyCode
End Sub

Private Sub FindButton_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, _
ByVal Shift As Integer)
ControlForms KeyCode
End Sub

Private Sub SummaryButton_KeyDown(ByVal KeyCode As MSForms.ReturnInteger, _
ByVal Shift As Integer)
ControlForms KeyCode
End Sub

When I press 'a' I get the desired result (AddOrFind userform pops up). *
When I press 'f' I get error 91 (Object variable or With Block variable not
set) at GetTitle.Show. *When I press 'v' I get error 438 (Object doesn't
support this property or method) at Summary.Show. *I have verified both
userforms are under the correct name and the code compiles. *What's the
problem?