Deal All,

I am Devaraj,
i have Excel-2010 tool which is running from Citrix environment, during paste the string in to the active sheet with in loop i am frequently getting Run-Time error '1004': Paste method of work sheet class failed. when i execute same tool in client machine i am not getting any run time error like this, only its happening when i run the tool in Citrix environment. I would be appreciate if any one could provide the solution for this issue ASAP.

below is the code.

Sub ESB_Report(Optional strRptScript As String)
Dim ClipB As New DataObject
Dim pOutput As Integer
Dim pLock As Integer
Const szRString = 4096 '*** Default -> 256
Dim RString As String * szRString

Cells.ClearContents
pOutput = ESB_YES
pLock = ESB_NO
If strRptScript = "" Then
strRptScript = RepScr
End If
sts = EsbReport(hCtx, pOutput, pLock, strRptScript)
If sts <> 0 Then Call MSGMSG: Exit Sub
X = 0
If sts = 0 Then
sts = EsbGetString(hCtx, RString, szRString)
If sts <> 0 Then Call MSGMSG: Exit Sub
Do While Mid$(RString, 1, 1) <> Chr$(0)
X = X + 1
DoEvents
ClipB.SetText RString
ClipB.PutInClipboard
Cells(X, 1).Select
ActiveSheet.Paste
sts = EsbGetString(hCtx, RString, szRString)
If sts <> 0 Then Call MSGMSG: Exit Sub
Loop
End If
End Sub

Thanks in Advance
Regards,
Devaraj.