View Single Post
  #3   Report Post  
Posted to microsoft.public.excel.programming
Brian Brian is offline
external usenet poster
 
Posts: 683
Default Question about User Form Window Size on Chip Petersons Site

Can you please explain exactly what this code is going to do?

My Biggest problem is that my User Form only works on my Display. When I try
and use it on any other computer Not only is the User Form to big, but the
Main Window the User Form is in goes completely off the screen.

I want the User Form Window to act just like any other Window. With Min, Max
& Resize, just like a reqular window would do.

Thanks for your response.
"Peter T" wrote:

There are various ways, this is probably the easiest although it may hide
the task bar

Private Declare Function SetWindowLong Lib "user32" Alias _
"SetWindowLongA" ( _
ByVal hWnd As Long, ByVal nIndex As Long, _
ByVal dwNewLong As Long) As Long

Private Declare Function ShowWindow Lib "user32" ( _
ByVal hWnd As Long, _
ByVal nCmdShow As Long) As Long

Private Const SW_MAXIMIZE As Long = 3

Private Sub UserForm_Activate()
Dim hWnd As Long
With Me
.Caption = Rnd()
hWnd = FindWindow("ThunderDFrame", .Caption)
.Caption = "Hello"
End With
ShowWindow hWnd, SW_MAXIMIZE
End Sub

Regards,
Peter T


"Brian" wrote in message
...
I have a User Form that I need to adjust to fit the users computer. So far
I
not found anyway to get the User Form Window to Adjust. I can adjust the
User
Form sixe, but the Main Window the Form located is in is still bigger than
the Screen.

I saw on Chip Petersons site exactly what I need. His code allows complete
control over the User Form just as if it was a regular window.

Can anyone help me with this code?
http://www.cpearson.com/Excel/formcontrol.aspx



.