Improve company productivity with a Business Account.Sign Up

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 192
  • Last Modified:

ProgressBar update when opening an Excel File

Does anyone know of a way to update the progressbar (increase the value) when opening an Excel file. The code I am using to open the file is: Workbooks.Open ('the name of the file')

Since the file takes about 20-30 seconds to open, I want to add a progress bar on the form. But, since the code can only be read one line a time, the progress bar's value will not change until the Excel file is open. I would like the progress bars value to change DURING opening of the file. Please let me know if you have an answer to this question. If you have some sample code that will even be better! Thanks!

PS - the Timer does not work because code can only be read one line at a time and during run time the code will stop at Workbooks.Open (the name of file) until the workbook open procedure is complete. Is there a way to get around this?
0
97luder
Asked:
97luder
  • 8
  • 3
  • 2
  • +2
1 Solution
 
Éric MoreauSenior .Net ConsultantCommented:
Because Excel does not trigger any events giving you the progress, it can't be done!
0
 
smkkaleemCommented:
Use a timer control originally diaabled. Enable it right after the Workbooks.Open ('the name of the file') code.

Write code in the timer event to increase the progress bar value using the approximate time as the max value that your Excel file takes to load.

0
 
Éric MoreauSenior .Net ConsultantCommented:
I really think that the timer won't trigger the event while the Open will execute.
0
Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
akkalamCommented:
It is better to use Time Control.
--------------------------------------
Dim i as integer
dim flag as boolean

Private sub Command_click()

Opening Excel.....
flag=false

End sub

Private sub Timer1_Time()
if flag=true then
ProgressBar1.Value=<var>
<var>=<var>+10
else
ProgressBar1.value=100 'if it's Maxlimit is 100
endif
End sub

0
 
smkkaleemCommented:
oops!!!Use a timer control originally disabled. Enable it right after the "DoEvents" line that should be inserted right after the Workbooks.Open ('the name of the file') code.

Write code in the timer event to increase the progress bar value using the approximate time as the max
value that your Excel file takes to load.

0
 
Éric MoreauSenior .Net ConsultantCommented:
Do you have your progress bar?
0
 
97luderAuthor Commented:
smkkaleem: The Timer control does not work because code can only be read one line at a time and during run time the code will stop at Workbooks.Open (the name of file) until the workbook open procedure is complete, then it will call the timer control which is already too late.

emoreau: You asked "Do you have your progress bar?". Im not sure what you mean. But, yes I have added the control 'Microsoft ProgressBar Control,  Version (6.0)' to VB.
0
 
97luderAuthor Commented:
smkkaleem: The Timer control does not work because code can only be read one line at a time and during run time the code will stop at Workbooks.Open (the name of file) until the workbook open procedure is complete, then it will call the timer control which is already too late.

emoreau: You asked "Do you have your progress bar?". Im not sure what you mean. But, yes I have added the control 'Microsoft ProgressBar Control,  Version (6.0)' to VB.
0
 
97luderAuthor Commented:
smkkaleem: The Timer control does not work because code can only be read one line at a time and during run time the code will stop at Workbooks.Open (the name of file) until the workbook open procedure is complete, then it will call the timer control which is already too late.

emoreau: You asked "Do you have your progress bar?". Im not sure what you mean. But, yes I have added the control 'Microsoft ProgressBar Control,  Version (6.0)' to VB.
0
 
Éric MoreauSenior .Net ConsultantCommented:
What I meant is that we didn't have your news for a couples of days.

<The Timer control does not work>

I said right at the beginning!!!
0
 
Éric MoreauSenior .Net ConsultantCommented:
97luder, you now have to do something with this question. Accept someone comment or delete it.
0
 
Éric MoreauSenior .Net ConsultantCommented:
Please maintain:

Questions Asked 1
Last 10 Grades Given  
Question Grading Record 0 Answers Graded / 0 Answers Received
0
 
Éric MoreauSenior .Net ConsultantCommented:
Please comment or close the question.
0
 
Éric MoreauSenior .Net ConsultantCommented:
Anybody here ?
0
 
NetminderCommented:
There has been no activity in this question in quite some time, and it looks like it has been abandoned. As part of our ongoing mission to clean up the topic areas, a Moderator will finalize this question within the next seven (7) days. At that time, either I or one of the other Moderators will force/accept the comment of emoreau.

DO NOT ACCEPT THIS COMMENT AS AN ANSWER. If you have further comments on this question or the recommendation, please leave them here.

Netminder
Community Support Moderator
Experts Exchange
0
 
NetminderCommented:
Per recommendation comment force/accepted by

Netminder
Community Support Moderator
Experts Exchange
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Upgrade your Question Security!

Your question, your audience. Choose who sees your identity—and your question—with question security.

  • 8
  • 3
  • 2
  • +2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now