2 PT-104 USB with 2 macro on a same computer

Post your VB and VBA discussions here
Post Reply
eqiom
Newbie
Posts: 0
Joined: Wed Mar 02, 2016 1:39 pm

2 PT-104 USB with 2 macro on a same computer

Post by eqiom »

Hello

Following some example and based on the advice from the previous topic, I made the following Excel spreatsheet to collect the data from the 2 PT-104 USB in a same file and in a same time (see attached file).

Now on the same computer, I want to start an excel macro to collect the data from one PT-104 USB during several hours and I want to start also a second excel macro (from another excel file) to collect the data from the second PT-104 USB during several hours too. Of course the two macro will not be started in the same time but they will worked very often together.

I never succeed to start the second macro while the first was already running. Each time I was starting the macro from one excel file, it was impossible to start the macro from the second excel file.

Do we have a solution to collect separatly on two different excel file, the data from the two PT-104 USB, on a same computer

I'm running a computer with Windows Seven 64 bits and Excel 2016. I have 2 PT-104 USB :
On the CQ493/053 I have four temperature measurement device
On the CV669/077 I have two temperature measurement device

Thank's a lot
Attachments
USBPT104_x64_EQIOM USB fonctionnel.xls
(57 KiB) Downloaded 843 times

Hitesh

Re: 2 PT-104 USB with 2 macro on a same computer

Post by Hitesh »

Hi eqiom,

Having run some tests here, it is possible to run two separate macros by doing the following:
  • Open the first Excel file
  • Open a new instance of Excel from the Windows Start Menu
  • Load the second file into the new instance of Excel
  • Start each macro running (use the serial number in the call to UsbPt104OpenUnit() to distinguish between each device)
You may also wish to rename the Module for each file in the Macro editor.

I hope this helps.

eqiom
Newbie
Posts: 0
Joined: Wed Mar 02, 2016 1:39 pm

Re: 2 PT-104 USB with 2 macro on a same computer

Post by eqiom »

Hello,

Finally I solved the problem by avoiding using the "Sleep" function, which is blocking the excel spreatsheet and preventing opening or working with another excel file.

The only way to be able to use excel while we are waiting between two measurement is to use the "Application.OnTime" function, which is sending directly the instruction to the kernel.

The excel file attached is a working example of collecting data from one controler with 4 measurement device.

I hope it will help one day.

regards
Attachments
Chaleur-hydratation-controleurA.xls
(89 KiB) Downloaded 683 times

Post Reply