... hope it helps!
--- Arduino code ---------------------------------------------------------------------
byte ledStates = 0;
void setup() {
Serial.begin(115200);
}
void loop() {
if(Serial.available()){serialComm();}
}
void serialComm(){
switch(Serial.read())
case 65: { // ascii for "A" received from Excel VBA
Serial.readBytes(ledStates, 8 ); // receiving from Excel VBA
Serial.print("This goes to Excel"); // sending to Excel VBA
break;
}
}
--- VBA code --------------------------------------------------------------------------
Dim COM2file As Integer
Public Sub ArdCOM2()
COM2file = FreeFile
Open "COM2:115200,BIN,CD0,CS0,DS0,OP0,RB64,RS,TB64" For Binary Access Read Write As #COM2file
Put #COM2file, , "A" 'send 1 byte to Arduino
Put #COM2file, , "01001100" 'send 8 bytes to Arduino, could be led states
ArdIn = Input(1, #COM2file) 'receive 1 byte from Arduino
ArdIn = Input(5, #COM2file) 'receive 5 bytes from Arduino
Close #COM2file
End Sub