View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
vqthomf vqthomf is offline
external usenet poster
 
Posts: 104
Default Progressbar during the CalulateFull execution

Hi Knokie
I use an API to run a progressbar it wont take much to add it to project.
HTH
Charles

Private Declare Function CreateWindowEX _
Lib "user32" _
Alias "CreateWindowExA" ( _
ByVal dwExStyle As Long, _
ByVal lpClassName As String, _
ByVal lpWindowName As String, _
ByVal dwStyle As Long, _
ByVal X As Long, _
ByVal y As Long, _
ByVal nWidth As Long, _
ByVal nHeight As Long, _
ByVal hWndParent As Long, _
ByVal hMenu As Long, _
ByVal hInstance As Long, _
lpParam As Any) _
As Long

Private Declare Function DestroyWindow _
Lib "user32" ( _
ByVal hwnd As Long) _
As Long

Private Declare Function SetParent _
Lib "user32" ( _
ByVal hWndChild As Long, _
ByVal hWndNewParent As Long) _
As Long

Private Declare Function SendMessage _
Lib "user32" _
Alias "SendMessageA" ( _
ByVal hwnd As Long, _
ByVal wMsg As Long, _
ByVal wParam As Long, _
lParam As Any) _
As Long

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

Dim rTemp
Dim m_frmHwnd As Long
Dim m_pbHwnd As Long
Dim m_strAviFile As String



Sub UpDateProgressBar()
'
iVal = Format(X / iMax, "0%")
Label3.Caption = iVal
SendMessage m_pbHwnd, &H402, ByVal Val(iVal), 0& '&H402
DoEvents
End Sub

Sub SetupProgressBar()
'
m_frmHwnd = FindWindow(vbNullString, Me.Caption)
W = Me.InsideWidth * 4 / 3
H = Me.InsideHeight * 4 / 3
Me.Repaint
'// ProgressBar [Leds: &H50000000] [Smooth: &H50000001]
m_pbHwnd = CreateWindowEX(0, "msctls_progress32", "", &H50000000, 7, H -
90, W - 15, 25, m_frmHwnd, 0, 0, 0)
SetParent m_pbHwnd, m_frmHwnd
DoEvents
End Sub
Sub EndProgressBar()
'
Label3.Caption = ""
DestroyWindow m_pbHwnd
DoEvents
End Sub



"Knokie From Holland" wrote:

Hi,

I have a very large worksheet that collect data from more then 50 other
sheets. During the CalculateFull statement the processor runs at 100% for 80
minutes.
Only the Taskmanager indicates that the program is stil running.

I need a progressbar to get a direct control in my worksheet.

Where is the tip that solves my problem?