网页加载器的进度栏

时间:2019-07-18 07:51:22

标签: excel vba

我想为网页加载程序创建加载栏。

我有一个名为LoadingInternet的带有代码的用户窗体(基本上是使用本教程https://wellsr.com/vba/2017/excel/beautiful-vba-progress-bar-with-step-by-step-instructions/创建的):

Private Sub UserForm_Initialize()
 Me.Height = Me.Height - 10
 'HideTitleBar.HideTitleBar Me
 subRemoveCloseButton Me
End Sub

如何编辑此文件,以便进度条显示网页的加载状态?这段代码适用于PelicanBrowser(实际的浏览器形式):

Private Sub UserForm_Initialize()

    Dim AppXCenter As Long, AppYCenter As Long
    AppXCenter = Application.Left + (Application.Width / 2)
    AppYCenter = Application.Top + (Application.Height / 2)
    With Me
    .StartUpPosition = 0
    .Top = AppYCenter - (Me.Height / 2)
    .Left = AppXCenter - (Me.Width / 2)
    End With

    PelicanBrowser.Controls("Label11").Caption = ThisWorkbook.Sheets("Other Data").Range("P23").Value

        With PelicanBrowser.WebBrowser1

    .Navigate "https://crm4.dynamics.com/main.aspx?area=nav_oppts&etc=3&page=SFA&pageType=EntityList&web=true"

               While .Busy
          DoEvents

            '(Step 1) Display your Progress Bar
            LoadingInternet.LabelProgress.Width = 0
            LoadingInternet.Show


            With LoadingInternet
            .LabelCaption.Caption = "Processing Row " & i & " of " & lastrow
            .LabelProgress.Width = pctdone * (.FrameProgress.Width)
            End With
            DoEvents

        Wend
        While .ReadyState <> 4
          DoEvents
        Wend
                    Unload LoadingInternet
    End With

End Sub

我想现在这个错了吗?

        With LoadingInternet
        .LabelCaption.Caption = "Processing Row " & i & " of " & lastrow
        .LabelProgress.Width = pctdone * (.FrameProgress.Width)
        End With
        DoEvents

0 个答案:

没有答案