ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   form stops execution (https://www.excelbanter.com/excel-programming/360139-form-stops-execution.html)

Marcos[_2_]

form stops execution
 
In excel macro working fine on Excel 2000 stops in excel 2002.
the macro stops at the statement showing a form. The debugger just
stops and highlights the show line with no error explanation. The form
includes a textbox and 2 buttons.

The calling sub is:
Option Compare Text
Public bOK1 As Boolean

Sub Auto_Open()
Dim s As Object
Dim x As String
Dim y As Integer
ExitStatus = False
Unload entrance
Do
entrance.Show
If Not bOK1 Then Exit Sub
x = entrance.bUser.Value
y = Val(x)
If y 0 Then
Set s = Sheets("TS")
d = Date
Do Until Weekday(d, vbSunday) = vbThursday
d = d + 1
Loop
s.Range("AM5") = d
s.Range("R3") = y
Exit Do
End If
Loop
Unload entrance
End Sub

And the form code is:
Private Sub bUser_Change()
End Sub

Private Sub CommandButton1_Click()
bOK1 = False
Unload Me
End Sub

Private Sub CommandButton2_Click()
bOK1 = True
Me.Hide
End Sub

Private Sub TextBox1_Change()
End Sub

Private Sub UserForm_Click()
End Sub

Thanks very much for your help
Marcos


Tom Ogilvy

form stops execution
 
If you go into tools=References (in the VBE) after the error, does it have
a reference to the Microsoft Forms 2.0 library?



--
Regards,
Tom Ogilvy


"Marcos" wrote in message
ups.com...
In excel macro working fine on Excel 2000 stops in excel 2002.
the macro stops at the statement showing a form. The debugger just
stops and highlights the show line with no error explanation. The form
includes a textbox and 2 buttons.

The calling sub is:
Option Compare Text
Public bOK1 As Boolean

Sub Auto_Open()
Dim s As Object
Dim x As String
Dim y As Integer
ExitStatus = False
Unload entrance
Do
entrance.Show
If Not bOK1 Then Exit Sub
x = entrance.bUser.Value
y = Val(x)
If y 0 Then
Set s = Sheets("TS")
d = Date
Do Until Weekday(d, vbSunday) = vbThursday
d = d + 1
Loop
s.Range("AM5") = d
s.Range("R3") = y
Exit Do
End If
Loop
Unload entrance
End Sub

And the form code is:
Private Sub bUser_Change()
End Sub

Private Sub CommandButton1_Click()
bOK1 = False
Unload Me
End Sub

Private Sub CommandButton2_Click()
bOK1 = True
Me.Hide
End Sub

Private Sub TextBox1_Change()
End Sub

Private Sub UserForm_Click()
End Sub

Thanks very much for your help
Marcos




Marcos[_2_]

form stops execution
 
Hi & thanks,
after stopping the debugger, Tools references highlights the windows
commn controld 6 row

Marcos


Tom Ogilvy

form stops execution
 
If you application doesn't use that control, uncheck it. If you can't then
select it and hit the browse button and see if you can fix the reference by
finding it.

If it isn't needed, try unchecking it or going back to the machine where the
workbook was created and uncheck it there. Then copy the revised file and
trying to use it on the new machine.

--
Regards,
Tom Ogilvy




"Marcos" wrote in message
oups.com...
Hi & thanks,
after stopping the debugger, Tools references highlights the windows
commn controld 6 row

Marcos




Marcos[_2_]

form stops execution
 
Thanks,
but it seems that this reference is in use, as VB says it can't remove
the control.
The control file (mscomct2.ocx) is present in both computers.
(the developing computer is WinXP and excel 2000 - where it works file,
and the other is win2000 with excel 2002)

Marcos


Tom Ogilvy

form stops execution
 
If you know it isn't being use, then I have been successful in removing a
reference using code.

See the reference collection in the Microsoft Visual Basic Extensibility
Library.

It has a remove method.

--
Regards,
Tom Ogilvy


"Marcos" wrote:

Thanks,
but it seems that this reference is in use, as VB says it can't remove
the control.
The control file (mscomct2.ocx) is present in both computers.
(the developing computer is WinXP and excel 2000 - where it works file,
and the other is win2000 with excel 2002)

Marcos




All times are GMT +1. The time now is 07:27 AM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
ExcelBanter.com