ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   userform question (https://www.excelbanter.com/excel-programming/295054-userform-question.html)

keyur

userform question
 

just a simple question if there's a statement for
deactivating a form. bec its not running the form event
when i click on the spreadsheet again. if you need i have
explain a bit on why i need this.

thanks

i m using a form just to place some commandbuttons(each
associated to a macro). i have like 10 buttons so the form
is long. i want to reduce its length when its not active

wht i am using is

Private Sub UserForm_Activate()
UserForm1.Height = 231
End Sub


Private Sub UserForm_Deactivate()
UserForm1.Height = 51
End Sub

i have

userform1.show modeless
AppActivate Application.Caption

in all the macros and quite a few worksheet events(bec as
soon as i run a macro the form becomes invisible) it is
not deactivating the form even if its not in focus and so
it never reduces its height.

Kevin Beckham

userform question
 
Try this

Private Sub UserForm_MouseMove(ByVal Button As Integer,
ByVal Shift As Integer, ByVal X As Single, ByVal Y As
Single)
If X < 6 Or X Me.Width - 6 Or Y < 1 Or Y
Me.Height - 21 Then
Me.Height = 51
Else
Me.Height = 231
End If
End Sub


Kevin Beckham
-----Original Message-----

just a simple question if there's a statement for
deactivating a form. bec its not running the form event
when i click on the spreadsheet again. if you need i have
explain a bit on why i need this.

thanks

i m using a form just to place some commandbuttons(each
associated to a macro). i have like 10 buttons so the

form
is long. i want to reduce its length when its not active

wht i am using is

Private Sub UserForm_Activate()
UserForm1.Height = 231
End Sub


Private Sub UserForm_Deactivate()
UserForm1.Height = 51
End Sub

i have

userform1.show modeless
AppActivate Application.Caption

in all the macros and quite a few worksheet events(bec as
soon as i run a macro the form becomes invisible) it is
not deactivating the form even if its not in focus and so
it never reduces its height.
.


keyur

userform question
 
thanks kevin. that exactly what i was looking for.

it works ok when the mouse move over it but sometimes when
i get away from it in x direction it down downsizes
itself. if you could explain me briefly that "if"
condition maybe it will work out.

thanks a lot again.


-----Original Message-----
Try this

Private Sub UserForm_MouseMove(ByVal Button As Integer,
ByVal Shift As Integer, ByVal X As Single, ByVal Y As
Single)
If X < 6 Or X Me.Width - 6 Or Y < 1 Or Y
Me.Height - 21 Then
Me.Height = 51
Else
Me.Height = 231
End If
End Sub


Kevin Beckham
-----Original Message-----

just a simple question if there's a statement for
deactivating a form. bec its not running the form event
when i click on the spreadsheet again. if you need i

have
explain a bit on why i need this.

thanks

i m using a form just to place some commandbuttons(each
associated to a macro). i have like 10 buttons so the

form
is long. i want to reduce its length when its not active

wht i am using is

Private Sub UserForm_Activate()
UserForm1.Height = 231
End Sub


Private Sub UserForm_Deactivate()
UserForm1.Height = 51
End Sub

i have

userform1.show modeless
AppActivate Application.Caption

in all the macros and quite a few worksheet events(bec

as
soon as i run a macro the form becomes invisible) it is
not deactivating the form even if its not in focus and

so
it never reduces its height.
.

.



All times are GMT +1. The time now is 04:48 AM.

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