Perchè questa subroutine lanciata circa 4700 volte genera l'errore "ERRORE 7 MEMORIA ESAURITA"? Errore che tra l'altro non riesco ad intercettare in fase di esecuzione.
La comunicazione DDE avviene con un applicativo di nome RSLinx che a sua volta comunica in TCP/IP con un PLC.


Sub ReadPLC(Topic, Item, ValRead)
'Topic = nome topic per la comunicazione DDE con RSLinx, applicativo
'della Rockwell automation che gestisce la comunicazione con il PLC
'Item = nome della variabile da leggere sul PLC
'ValRead = valore restituito dalla lettura

On Error GoTo GErr
'ComRSL è un form dove è presente una textbox di nome RSL
L00:
ComRSL.RSL.LinkTopic = "RSLinx|" & Topic
ComRSL.RSL.LinkItem = Item
ComRSL.RSL.LinkMode = vbLinkManual
ComRSL.RSL.LinkRequest
ValRead = ComRSL.RSL.Caption
ComRSL.RSL.LinkMode = 0

Exit Sub
GErr:
Select Case Err.Number
Case 282
Msg = "Errore " & Err.Number & Chr(13)
Msg = Msg & "Manca comunicazione con PLC" & Chr(13)
Msg = Msg & "Riprovare ?"
If MsgBox(Msg, 4, "ReadPLC") = vbYes Then
ValRead = "NO"
Exit Sub
End If
End
Case 287 'Tasto ESC durante un'operazione DDE
GoTo L00
Case Else
Msg = "Errore " & Err.Number & Chr(13)
Msg = Msg & Err.Description & Chr(13)
Msg = Msg & Topic & "|" & Item
MsgBox Msg, , "ReadPLC"
End
End Select

End Sub

Grazie per la collaborazione, non so più che pesci pigliare...