Friday 3 February 2017

VBA code for adding progress bar.

Private Sub UserForm_Initialize()
    lblProgressBar.Width = 0
    lblProgressBar.BackColor = RGB(4, 217, 39)
    If Application.International(xlCountryCode) = 49 Then       'German
        ufProgressBar.Caption = "Ihre Anfrage wird bearbeitet..."
    Else
        ufProgressBar.Caption = "Processing Your Request. Please Wait..."
    End If
   
End Sub

Private Sub UserForm_QueryClose(Cancel As Integer, CloseMode As Integer)
    If CloseMode = 0 Then
        Cancel = True
    End If
End Sub

ufProgressBar.Show vbModeless
ufProgressBar.Caption = "Importing data into worksheets " & obj.index & " of " & wb.Sheets.Count
                ufProgressBar.lblProgressBar.Width = CInt((obj.index * 100) / (wb.Sheets.Count)) * ufProgressBar.Width / 100
                ufProgressBar.Repaint

Unload ufProgressBar

No comments:

Post a Comment