All:
I'm new to VBA, however I'm an experienced programmer. I'm running the following routine:
Sub do_dde()
Dim ddeChannel As Long
Dim test As Variant
ddeChannel = DDEInitiate("MH", "AAPL.CCC")
test = DDERequest(ddeChannel, "pVga")
DDETerminate ddeChannel
For i = LBound(test) To UBound(test)
Worksheets("Sheet2").Cells(i, 1) = test(i)
Next i
End Sub
The bolded line gives the subscript out of line error. As an additional debug step, I tried declaring another random variable called test2 (variant) and the line test2 = test(i) also returns this error.
This is very puzzling to me, as the LBound and UBound of test (as determined by stepping through the code) are 1 and 66 returned, yet this is crashing out on the first iteration of the loop when i=1!!!
Does anyone have any insight in to this whatsoever?! I have burned a whole day on this with no progress, and I would really appreciate any help.
Thanks in advance, mcukier
Bookmarks