VBA multithreading in rhapsody

1 Star2 Stars3 Stars4 Stars5 Stars (No Ratings Yet)
Loading...
806 views
0

Hi

I am in the process of trying to multithread a small VBA macro in rhapsody.
I am using the method from you guys https://analystcave.com/excel-vba-multithreading-tool/

whenever I run my macro the code breaks when ParallelAsyncInvoke or ParallelFor gets invoked.

Any tips on using these classes in rhapsody? the vba should be the same as excel. I am however running on windows XP so maby old version? the version of VBA is 6.3

0

Fedor the multithreading macro will only work in Excel VBA as it needs to create several instances of the Workbook. In C# there is a native Parallel.ForEach loop and this method is not needed there: see example.

commented on answer
Avatar

Yeah I managed to get multithreading to work with c#. Cant do what I need it to do though. need multiple handles on Rhapsody instance. Thanx though

0

Hi Fedor,

the multithread macro is not something that works out of the box. However, best if you could provide an example of how you are executing the code and what is the main logic.

In general I advise you start with a simple example from my main page and then slowly start adding your logic on top (https://analystcave.com/excel-vba-multithreading-tool/).

The macro simply replicates your file and runs each of the files in paralell using a VBscript. Hence code might break if there is anything that uses your original file name etc.

commented on answer
Avatar

Hi Thanx for the response. All I am trying currently is invoking parallelFor on the example in your link. In excel with VBA version 7.1 it works perfectly. .The method to be threaded is simply a for loop, can be empty or have a one liner doing something. In rhapsody when I debug, the line it breaks on the the call to “Call parallelClass.ParallelFor(*, *, *)”. I am Considering rewriting my script in c#, will be a pain though >.<. Good piece of code you wrote though, :) edit: sorry I cant seem to space my paragraphs in this comment. sorry for the uneasy read

Simply the best place to learn Excel VBA