Hi All,
I have an application that creates/displays certain reports using Microsoft Excel (2002 to be exact). What I do is the following:
1 - Collect the data that needs to be displayed:
2 - Create an instance of an Excel application using a previously-created template workbook which contains the modules with subs and functions that perform all the work.
3 - Call a sub/function in the Excel application, sending it, as parameters, all the data needed.
That sub/function on step three is one that I created priviously, like I said, and it's in charge of taking the data and displaying it on the worksheet nicely formatted. When the sub/function completes its operation, it shows Excel (which was previously hidden) and the user is very very happy.
OK - enough background info. Well, that sub from step 3 above could take quite a while (even up to 15 seconds or more on fast machines) to complete. I would love to provide the user with:
1 - A progress bar that shows the percentage of work remaining.
2 - A cancel button to allow the user to stop the sub prematurely.
But you see, as of right now, I cannot do that beause I don't know how to talk back to my VB6 app from Excel. Once I call that sub on step 3, control passes to Excel and the program just waits, and waits until Excel is done and execution comes back to it. If I could have the Excel sub run on a different thread and call back a function on my VB6 app every once in a while to say hi and to inform of the progress, it would be great.
Thus, the questions are:
1 - Is there anyway to talk back to my application from Excel so that I could update a progress bar to inform the user of the progress?
2 - In case the user wants to cancel the operation, how then would I talk back to Excel to tell it to stop working.
JC
Friends are angels who lift us to our feet when our wings have trouble remembering how to fly...
I have an application that creates/displays certain reports using Microsoft Excel (2002 to be exact). What I do is the following:
1 - Collect the data that needs to be displayed:
2 - Create an instance of an Excel application using a previously-created template workbook which contains the modules with subs and functions that perform all the work.
3 - Call a sub/function in the Excel application, sending it, as parameters, all the data needed.
That sub/function on step three is one that I created priviously, like I said, and it's in charge of taking the data and displaying it on the worksheet nicely formatted. When the sub/function completes its operation, it shows Excel (which was previously hidden) and the user is very very happy.
OK - enough background info. Well, that sub from step 3 above could take quite a while (even up to 15 seconds or more on fast machines) to complete. I would love to provide the user with:
1 - A progress bar that shows the percentage of work remaining.
2 - A cancel button to allow the user to stop the sub prematurely.
But you see, as of right now, I cannot do that beause I don't know how to talk back to my VB6 app from Excel. Once I call that sub on step 3, control passes to Excel and the program just waits, and waits until Excel is done and execution comes back to it. If I could have the Excel sub run on a different thread and call back a function on my VB6 app every once in a while to say hi and to inform of the progress, it would be great.
Thus, the questions are:
1 - Is there anyway to talk back to my application from Excel so that I could update a progress bar to inform the user of the progress?
2 - In case the user wants to cancel the operation, how then would I talk back to Excel to tell it to stop working.
JC
Friends are angels who lift us to our feet when our wings have trouble remembering how to fly...