![]() |
Excel VBA Progress bar on a userform
Is it possible to implement a progress bar on a userform in Excel?
I don't find any info about progress bars in the Help or Manuals -- Message posted from http://www.ExcelForum.com |
Excel VBA Progress bar on a userform
Hi,
I have an example with a few variations. http://www.andypope.info/vba/pmeter.htm as does John Walkenbach. http://j-walk.com/ss/excel/tips/tip34.htm Cheers Andy Bo_ < wrote: Is it possible to implement a progress bar on a userform in Excel? I don't find any info about progress bars in the Help or Manuals. --- Message posted from http://www.ExcelForum.com/ -- Andy Pope, Microsoft MVP - Excel http://www.andypope.info |
Excel VBA Progress bar on a userform
You could also try using a modeless form in XL2000 or above, as in this
approach: http://www.enhanceddatasystems.com/E...rogressBar.htm Robin Hammond www.enhanceddatasystems.com "Bo_ " wrote in message ... Is it possible to implement a progress bar on a userform in Excel? I don't find any info about progress bars in the Help or Manuals. --- Message posted from http://www.ExcelForum.com/ |
Excel VBA Progress bar on a userform
Hi Bo_,
a possibility with API: In UserForm module: Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" _ (ByVal lpClassName As String, ByVal lpWindowName As String) As Long 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 SendMessage Lib "user32" _ Alias "SendMessageA" (ByVal hwnd As Long, ByVal wMsg As Long, _ ByVal wParam As Long, lParam As Any) As Long Private Sub CommandButton1_Click() Me.CommandButton1.Enabled = False Me.Repaint Dim y&, W&, mehWnd&, pbhWnd&, i& mehWnd = FindWindow(vbNullString, Me.Caption) W = Me.InsideWidth * 4 / 3 y = (Me.InsideHeight - 15) * 4 / 3 pbhWnd = CreateWindowEX(0, "msctls_progress32", "" _ , &H50000000, 0, y, W, 20, mehWnd, 0&, 0, 0&) SendMessage pbhWnd, &H409, 0, ByVal RGB(0, 125, 0) For i = 1 To 50000 DoEvents SendMessage pbhWnd, &H402, CInt(100 * i / 50000), 0 Next i DestroyWindow pbhWnd Me.CommandButton1.Enabled = True End Sub Regards, MP "Bo_ " a écrit dans le message de ... Is it possible to implement a progress bar on a userform in Excel? I don't find any info about progress bars in the Help or Manuals. --- Message posted from http://www.ExcelForum.com/ |
All times are GMT +1. The time now is 01:36 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com