vba11-7.txt

来自「ao的一些代码集合」· 文本 代码 · 共 42 行

TXT
42
字号

Public Sub ShowProgressDialog()
  Dim pProgressDialogFactory As IProgressDialogFactory
  Dim pProgressDialog As IProgressDialog2
  Dim pStepProgressor As IStepProgressor
  Dim pTrackCancel As ITrackCancel
  Dim lngIndex As Long
  Dim blnContinue As Boolean
 
  ' Use the Progress Dialog Factory to create
  ' a Progress Dialog.
  Set pTrackCancel = New CancelTracker
  Set pProgressDialogFactory = New ProgressDialogFactory
  Set pProgressDialog = pProgressDialogFactory. _
  Create(pTrackCancel, 0)
  ' Enable the cancel button on the dialog.
  pProgressDialog.CancelEnabled = True
  pProgressDialog.Title = "Example of Progress Dialog"
  ' Use a built in animation.
  pProgressDialog.Animation = esriProgressGlobe
  blnContinue = True

  ' Set up the progress bar on the dialog.
  Set pStepProgressor = pProgressDialog
  pStepProgressor.MinRange = 0
  pStepProgressor.MaxRange = 10000
  pStepProgressor.StepValue = 1

  For lngIndex = 0 To 10000
    ' Carry out the long process here.
    ' Use the Message property to inform
    ' user about the macro's activity.
    pStepProgressor.Message = lngIndex & _
    " of 10000" & " loop"
    ' Stop processing if Cancel button is selected
    blnContinue = pTrackCancel.Continue
    pStepProgressor.Step
    If Not blnContinue Then Exit For
  Next lngIndex

End Sub

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?