View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Peter T Peter T is offline
external usenet poster
 
Posts: 5,600
Default Question about User Form Window Size on Chip Petersons Site

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