VBModal Error

J

Jenny

Ok, I have a macro with a userform in it called MainForm.
When I try to run the command MainForm.Show VbModal I get
an error. It tells me that the method is not recognized
(and it highlights VbModal). When I change the command to
MainForm.Show 1 (which is the same as the previous
command) I get an error saying that there are the wrong
number of arguments.

Also, I only get this error on machines running Windows
98. I registered the appropriate DLLs and I have done
everything else I can think of to fix this. Can someone
please tell me why this is happening and how to fix it?

Thanks!

~Jenny
 
T

Tom Ogilvy

Excel 97 didn't have any arguments to the Show command I don't believe (at
least it didn't support modeless userforms, so no reason to have an
argument). Are these machines running xl97?
 
J

Jenny

Tom,
Ah, it appears that they are using XL97. I can just write
a bit of code to check the version before it calls the
show event. Thank you for helping out with this one!

~Jen
 
M

Michel Pierron

Hi Jenny;
With xl97, you can use:
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _
(ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function EnableWindow Lib "user32" _
(ByVal hwnd As Long, ByVal fEnable As Long) As Long

Private Sub UserForm_Activate()
EnableWindow FindWindow(vbNullString, Application.Caption), 1
End Sub

MP
 
Top