I have code that retrieves data from Excel through the DDE inteface. The code works fine on Windows 32-bit. However, when I run the code on Windows 64-bit, I can only call DDEREQ exactly 63 times, at the 64th time, an error is thrown.
Reproduction steps:
1. Open an Excel file and enter a value in a cell. Define an alias for the cell with the name 'Dummy'. Keep Excel open.
2. Run the following code in MATLAB:
for i=1:100 exChannel = ddeinit('Excel', 'Sheet1'); % Read cell marked as 'Dummy'.
% Crashes at i=64 on Win64.
retValue = ddereq(exChannel, 'Dummy'); rc = ddeterm(exChannel); clear exChannel; end
On Windows 64-bit, the following error will occur on the 64th iteration:
??? Error using ==> ddereq
The first argument 'channel' is not valid.
Best Answer