View Single Post
  #5   Report Post  
Posted to microsoft.public.excel.programming
Alan Alan is offline
external usenet poster
 
Posts: 188
Default How do I access a variable from another instance of excel?

"mark" wrote in message
...

Another way to do it would be to throw the variable from your
running Excel process out to a text file, and read it in to the
other Excel instance.


Hi Mark,

I thought of that, and then considered that using a worksheet cell
might be even simpler:

NewExcel.Workbooks(1).Worksheets(1).Range("A1").Va lue

A1 (probably in a very hidden worksheet) would then be passed the
current value of ProgressCounter as it changes and I can read the
value from there easy enough.

However, that seems a little clunky!


But, when I your posting the first time, I was wondering if you had
thought about using a Userform with it's ShowModal property set to
0. If you did that, the modeless form would continue to display as
your job processed, and anywhere you wanted to, you could pass the
modeless form new data about the process of the job.

As long as you put in a DoEvents just after the update of the
modeless form, it should visibly show up fine.


I agree that a UserForm could work well. However, I would *prefer* to
use the statusbar if possible. It is a posibility though - thanks for
the suggestion! I may change my mind about the statusbar in which
case a userform is the likely next option - I will cogitate on that!


Thanks for your help,

Alan.