Thread: Userform Show
View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Francis Ang[_3_] Francis Ang[_3_] is offline
external usenet poster
 
Posts: 75
Default Userform Show

Try this, create a userform and place the following codes in the userform -

Private Declare Function FindWindow Lib "user32" Alias _
"FindWindowA" (ByVal lpClassName As String, _
ByVal lpWindowName As String) As Long

Private Declare Function GetWindowLong Lib "user32" Alias _
"GetWindowLongA" (ByVal hwnd As Long, _
ByVal nIndex As Long) As Long

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 DrawMenuBar Lib "user32" ( _
ByVal hwnd As Long) As Long
Private Function HideCaptionBar()
Dim lngHnd As Long
Dim lngStyle As Long
Dim lngH(1) As Long
Const GWL_STYLE = (-16)
Const WS_CAPTION = &HC00000
lngH(0) = Me.Height - Me.InsideHeight
If Val(Application.Version) 8 Then
lngHnd = FindWindow("ThunderDFrame", Me.Caption)
Else
lngHnd = FindWindow("ThunderXFrame", Me.Caption)
End If
lngStyle = GetWindowLong(lngHnd, GWL_STYLE) And Not WS_CAPTION
SetWindowLong lngHnd, GWL_STYLE, lngStyle
DrawMenuBar lngHnd
lngH(1) = Me.Height - Me.InsideHeight
Me.Height = Me.Height + lngH(1) - lngH(0)
End Function

Private Sub UserForm_Initialize()

Call HideCaptionBar

End Sub


Private Sub UserForm_Activate()

DoEvents
UserForm.Label="Processing ......"

Your codes here ...

Unload Userform

End Sub

I hope this help.


"Noemi" wrote:

Hi
I have 2 workbooks which compare the data on them to make sure everything
has been returned.

As this takes up half a day due to the size of the data I have created a
Userform which I would like to have showing while the checks are being
actioned behind this Userform.

Is there away to make this work as I keep loosing the focus of the userform
when the macro is run.

Thanks
Noemi