Implement a progress bar when the macro run inside another workboo

A

Alex St-Pierre

Hi,
I have a macro that generate a Word document from Excel with a progress bar
indicator. I have another Excel file (main file) that can create Word report
one by one by opening an excel file #1, create the report #1, opening excel
file #2, word report #2, etc. During this process, I would like to indicate
the progress bar of the file #1. #2, ... inside the main excel file progress
bar.
Thank you!
Alex

File #1 33%, 34%, 35%, etc.
File #2 0%
File #3 0%
I have a macro which is called "ExecuteReport" inside "Thisworkbook" class
module which is executed from the main excel file like:
Dim wb As Workbook
Load UserForm1 'ProgressBar
UserForm1.Show
For Each wb in ...
Set wb = Workbooks("File #i.xls")
wb.Executereport 'Is there a way to update Userform1 ProgressBar during
the production of the word document. (takes 2 minutes to do!)
set Wb = Nohting
Next wb
 
A

Alex St-Pierre

Thank's
Finally I did it by a transfer of the userform from wb#1 to wb#2.
In wb #1:
With UserForm1
.FrameProgress.Caption = Format(PctDone, "0%")
.LabelProgress.Width = PctDone * (.FrameProgress.Width - 10)
End With
DoEvents

Dim wb As Workbook
Dim docWord As Word.Document
Set wb = Workbooks("abc.xls")
wb.ExecuteReport docWord:=docWord, ExcelTable:=False, UserForm:=UserForm1

In wb #2, I have added the parameter:
Public Sub ExecuteReport(docWord As Word.Document, ExcelTable As Boolean,
userform As Object)
userform.FrameProgress.Caption = "Alex" update the userform!!

Thank's a lot!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top