Results 1 to 4 of 4

Progress Bar showing the count, rather than percentage

Threaded View

  1. #1
    Registered User
    Join Date
    02-20-2017
    Location
    New York, NY
    MS-Off Ver
    2010, 2013
    Posts
    14

    Progress Bar showing the count, rather than percentage

    I have a userform with a progress bar. Any ideas why the progress bar is showing the count, rather than % complete? In this instance there are 20 items, and as the progress bar runs, it starts at 1%, 2%, ending at 20%, rather than 100% (total count of the items is 20).

    Sub CreateFromTemplate ()
    
    Dim doc As Word.Document
    wd.Visible = False
    Dim DocumentRange As Range
    
    '/// PROGRESS BAR:
    Dim DocumentTotal As Integer
    Dim Counter As Integer
    Dim PctDone As Single
    '///
    
    Range("A11").Select
    Set DocumentRange = Range( _
    ActiveCell, _
    ActiveCell.End(xlDown))
    
    '/// PROGRESS BAR: Initialize variables
    Counter = 0
    DocumentTotal = Selection.Cells.Count
    '///
    
    For Each DocumentCell In DocumentRange
    Set doc = wd.Documents.Open(FilePath & "Template1.docx")
    
    CopyCell "Bookmark1", 3
    CopyCell "Bookmark2", 4
    CopyCell "Bookmark3", 5
    CopyCell "Bookmark4", 6
    CopyCell "Bookmark5", 7
    CopyCell "Bookmark6", 8
    
    doc.SaveAs2 FilePath & "Document " & DocumentCell.Value & ".docx"
    doc.Close
    
    '/// PROGRESS BAR:
            Counter = Counter + 1
            PctDone = Counter / DocumentTotal
            
        With DocumentModule
            .FrameProgress.Caption = Format(PctDone / 100, "0%")
            .ProgressBarBox.Width = PctDone * (.FrameProgress.Width - 10)
        End With
    
        DoEvents
    '///
    
    
    Next DocumentCell
    wd.Quit
    
    '/// PROGRESS BAR:
        With DocumentModule
            .ProgressBarBox.Width = 0
            .FrameProgress.Caption = "Progress Indicator"
        End With
    '///
    
    MsgBox "Created files in " & FilePath, vbInformation, "Document Generator"
    End Sub
    Last edited by Leith Ross; 09-25-2017 at 03:57 PM. Reason: Added Code Tags

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. How to count progress percentage in a row excluding a value
    By Mrerosennin in forum Excel Formulas & Functions
    Replies: 6
    Last Post: 02-05-2017, 08:35 AM
  2. showing the progress of the dependency
    By sanlen in forum Excel General
    Replies: 1
    Last Post: 12-14-2016, 02:40 AM
  3. [SOLVED] Chart showing progress
    By KClem in forum Excel Charting & Pivots
    Replies: 1
    Last Post: 10-29-2015, 07:55 AM
  4. Showing progress with arrows
    By bogdn in forum Excel General
    Replies: 2
    Last Post: 05-30-2013, 04:31 AM
  5. percentage progress bar in vba
    By djwaz69 in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 01-17-2013, 10:34 PM
  6. Need help showing progress bar
    By dontke in forum Excel Programming / VBA / Macros
    Replies: 1
    Last Post: 10-04-2012, 09:50 AM
  7. VBA: Progress bar not showing
    By kcjones242 in forum Excel Programming / VBA / Macros
    Replies: 2
    Last Post: 02-14-2011, 12:54 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1