Macro freezes Excel

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hi all

I wrote some macros to interact and manipulate data in Access from Excel
The macros works fine, but took quite a while to finish the calculation, around 2-3 minutes, and while performing the calculation, Excel freezes
If running that macro only once in a while is no problem.. but it's starting to get irritating if everytime you run the macro, you need to wait for 3 minutes before you can get back to the Excel file again

My question is
Is there any way to tell Excel to run the macro in the background so that I can still work on my Excel file while Excel is doing the calculation

Regards
Yohan
 
You have already asked this question 2 hours ago!

--

HTH

Bob Phillips
... looking out across Poole Harbour to the Purbecks
(remove nothere from the email address if mailing direct)

Yohan said:
Hi all!

I wrote some macros to interact and manipulate data in Access from Excel.
The macros works fine, but took quite a while to finish the calculation,
around 2-3 minutes, and while performing the calculation, Excel freezes.
If running that macro only once in a while is no problem.. but it's
starting to get irritating if everytime you run the macro, you need to wait
for 3 minutes before you can get back to the Excel file again.
My question is:
Is there any way to tell Excel to run the macro in the background so that
I can still work on my Excel file while Excel is doing the calculation?
 
Yes and No.
Yes: You can use the Win32 API to create a worker thread.
No: No native VBA support for this.
Marc


Yohan said:
Hi all!

I wrote some macros to interact and manipulate data in Access from Excel.
The macros works fine, but took quite a while to finish the calculation,
around 2-3 minutes, and while performing the calculation, Excel freezes.
If running that macro only once in a while is no problem.. but it's
starting to get irritating if everytime you run the macro, you need to wait
for 3 minutes before you can get back to the Excel file again.
My question is:
Is there any way to tell Excel to run the macro in the background so that
I can still work on my Excel file while Excel is doing the calculation?
 
You can create a worker thread in VBA using APIs? I've only seen this
done using MFCs in C++. Please post some exmaple code.
 
I Indeed doubt if it is possible to create a worker thread in VBA. What I
have done before is fire events from a thread in an ActiveX control. In this
way you can e.g. open a form and run some background code on interval base.

You are right, not a true worker thread.

Marc
 
Back
Top