진행률 막대 사용 방법에 대해 stackoverflow 통해 읽었습니다.진행 표시기, vba에서 응답하지 않게 됨
괜찮 았지만, 6 %의 짧은 시간이 지나면 235 행의 14 번째 행에 응답이 없다고 표시되고 루프가 완료 될 때까지 행해집니다.
그래서 실행하고 그것은 VBModeless 여기서 :
ProgressBar.Show vbModeless
ProgressBar.Label_WhatsGoingOn.Caption = "Reading data from database.."
projectNumber = "32966"
docOutArray = Post.helpRequest("xdnjgjrdin.asp?Dok4=" & projectNumber)
If CPearson.IsArrayEmpty(docOutArray) Then
MsgBox "No document registered in database!"
End If
ProgressBar.Label_WhatsGoingOn.Caption = "Creating Docout.."
Set doc_ = NEwDocOut.createDocOutDocument(projectNumber)
numOfRows = UBound(docOutArray, 1)
For i = LBound(docOutArray, 1) To numOfRows
ProgressBar.Label_WhatsGoingOn.Caption = "Creating Row.."
sPercentage = (i/numOfRows) * 100
ProgressBar.progress (sPercentage)
내 진행 막대 코드 :
Private Sub UserForm_Initialize()
Me.Text.Caption = "0% Completed"
End Sub
Public Sub progress(pctCompl As Single)
Me.Text.Caption = Format(pctCompl, "##") & "% Completed"
Me.Bar.Width = pctCompl * 2
Me.Repaint
DoEvents
End Sub
이런 일이 발생하는 이유 어떤 아이디어?
나는 "DoEvents는"모든 이벤트가 아닌 간주 생각 진행률 표시 줄을 업데이트하는 이벤트 만 일반적으로 이것은 문제가되지 않지만 사람들이 클릭 할 수있는 다른 단추/양식이있는 경우 해당 클릭이 이미 실행중인 코드를 방해하지 않도록 예방 조치를 취해야합니다. – Shimeon
@skatun이 답변을 찾았습니까? – User632716
예, @tompreston 일종의, 문제는 지금은 몇 번 progressbar가 백그라운드에서 도착하고 때로는 progressbar가 이미 존재하거나 sth이기 때문에 progressbar가 표시 될 수 없다는 코드가 실패합니다. 나는 지금 이것을보고있다. – skatun