+ Reply to Thread
Results 1 to 7 of 7

Run-Time error '1004': Paste method of work sheet class failed

  1. #1
    Registered User
    Join Date
    03-25-2015
    Location
    Bangalore
    MS-Off Ver
    2010
    Posts
    4

    Question Run-Time error '1004': Paste method of work sheet class failed

    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.

  2. #2
    Forum Guru
    Join Date
    03-02-2006
    Location
    Los Angeles, Ca
    MS-Off Ver
    WinXP/MSO2007;Win10/MSO2016
    Posts
    12,625

    Re: Run-Time error '1004': Paste method of work sheet class failed

    Your post does not comply with Rule 3 of our Forum RULES. Use code tags around code.

    Posting code between [CODE]Please [url=https://www.excelforum.com/login.php]Login or Register [/url] to view this content.[/CODE] tags makes your code much easier to read and copy for testing, it also maintains VBA formatting.

    Highlight your code and click the # icon at the top of your post window. More information about these and other tags can be found here



    (This thread should receive no further responses until this moderation request is fulfilled, as per Forum Rule 7)
    Ben Van Johnson

  3. #3
    Registered User
    Join Date
    03-25-2015
    Location
    Bangalore
    MS-Off Ver
    2010
    Posts
    4

    Re: Run-Time error '1004': Paste method of work sheet class failed

    Thanks for update,
    Pls find the below code:

    Please Login or Register  to view this content.

  4. #4
    Forum Contributor dlow's Avatar
    Join Date
    08-12-2013
    Location
    EveryWhere
    MS-Off Ver
    Excel 2007, 2010
    Posts
    275

    Re: Run-Time error '1004': Paste method of work sheet class failed

    Ahh... well your using the clipBoard so wouldnt it be ClipB.paste or something like that? I dun-no its been awhile since Ive played with it myself. This might Help [Clipboard Operations]
    1st thing Google gave me was this. Also did you look @ the "SimilarThreads" below sometimes its helpful.

    oh, your rangeClass failed, so VBA is saying where do you want me to put it. ActiveSheet is not a range. Try giving it a Range GoodLuck

  5. #5
    Registered User
    Join Date
    03-25-2015
    Location
    Bangalore
    MS-Off Ver
    2010
    Posts
    4

    Re: Run-Time error '1004': Paste method of work sheet class failed

    Thanks for your valuable update.
    the same code is working fine in client machine, the run time error '1004' is coming only in Citrix environment.
    So, Kindly provide the solution.

  6. #6
    Forum Contributor dlow's Avatar
    Join Date
    08-12-2013
    Location
    EveryWhere
    MS-Off Ver
    Excel 2007, 2010
    Posts
    275

    Re: Run-Time error '1004': Paste method of work sheet class failed

    the run time error '1004' is coming only in Citrix environment
    Open a new thread linking back to this one. Asking for help with your more defined problem, so you can get the right help.

    Or better yet change the title of this one. To do that you have to edit your 1st post, & then go to advanced edit; there you can change the title so the right people see what your issue is.
    Last edited by dlow; 03-26-2015 at 09:10 AM.

  7. #7
    Forum Contributor dlow's Avatar
    Join Date
    08-12-2013
    Location
    EveryWhere
    MS-Off Ver
    Excel 2007, 2010
    Posts
    275

    Re: Run-Time error '1004': Paste method of work sheet class failed

    Hi devaraj2020,

    I see your new post & none of my business but the powers that be are going to get on you for not backlinking this post & might not help you buddy. I dont want to post in your new thread so you get All eyes on it. If I were you I would edit with a link pointing back here. JMO

+ Reply to Thread

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Run Time Error '1004': Paste Method of Worksheet Class Failed
    By greuben in forum Excel Programming / VBA / Macros
    Replies: 5
    Last Post: 02-17-2015, 02:25 PM
  2. Getting Run-Time error '1004': Paste method of Worksheet class failed
    By randomguy1 in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 11-06-2013, 10:47 PM
  3. [SOLVED] Run-time error 1004 paste method of worksheet class failed
    By Castillb in forum Excel Programming / VBA / Macros
    Replies: 9
    Last Post: 08-12-2013, 02:24 PM
  4. Help with a Macro-Paste method of worksheet class failed run time error 1004
    By mcneill_garr in forum Excel Programming / VBA / Macros
    Replies: 6
    Last Post: 08-10-2011, 03:10 PM
  5. Run-time error '1004': Paste method of Worksheet class failed
    By shafto in forum Excel Programming / VBA / Macros
    Replies: 3
    Last Post: 06-05-2009, 07:49 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts

Search Engine Friendly URLs by vBSEO 3.6.0 RC 1