Results 1 to 10 of 551

Thread: Tests Copying pasting Cliipboard issues

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #11
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,411
    Rep Power
    10
    This is post #101https://www.excelfox.com/forum/showt...ll=1#post17966
    https://www.excelfox.com/forum/showthread.php/2824-Tests-Copying-pasting-Cliipboard-issues?p=17966&viewfull=1#post17966
    https://www.excelfox.com/forum/showt...ge11#post17966
    https://www.excelfox.com/forum/showthread.php/2824-Tests-Copying-pasting-Cliipboard-issues/page11#post17966




    Repairing and Gleaning some information from here
    https://www.mrexcel.com/board/thread...board.1087948/


    Yasser tried to get some help from us at eileenslounge.com in 2019 to get VBA to do like clicking that Clear All Button
    We got as far it working in Office versions 2003 2007 2010 ( https://eileenslounge.com/viewtopic....246770#p246770
    https://eileenslounge.com/viewtopic....246838#p246838
    ) , that was all I had at the time.
    Yasser went off to mrexcel.com and got some interesting info from Jaafar Tribak , who tried bit failed still to get it working in Office 2016. (Back then he only had Office versions 2007 2010 and 2013). Never the less, there was some interesting stuff there to review, unfortunately that mrexcel thread has got a bit messed up by a forum software update, so I tried to make a repaired summarized copy of it, only pulling out the important bits here
    Yassers comments/ posts are the
    Yaz: ………
    , Jaafar Tribak’s suggestions are
    Jaf: ………
    , and any new comments or minor modifications from me, based on me trying some of Jaafar Tribak’s suggestions or other more recent experiments are
    Alan 2024: …..




    Jaf: Trys this
    Code:
    Option Explicit
        #If VBA7 Then
         Declare PtrSafe Function AccessibleChildren Lib "oleacc" (ByVal paccContainer As Office.IAccessible, ByVal iChildStart As Long, ByVal cChildren As Long, ByRef rgvarChildren As Any, ByRef pcObtained As Long) As Long
        #Else
         Declare Function AccessibleChildren Lib "oleacc" (ByVal paccContainer As Office.IAccessible, ByVal iChildStart As Long, ByVal cChildren As Long, ByRef rgvarChildren As Any, ByRef pcObtained As Long) As Long
        #End If
    
    
    Sub ClearOfficeClipBoard()
        Dim avAcc, bClipboard As Boolean, j As Long
    Dim MyPain As String 'COMsOLEwollupsActivelyEmmbeddedXratedObjectHookMyBoutonOhFolloks
        If CLng(Val(Application.Version)) <= 11 Then  '  Case 11: "Excel 2003" Windows  "Excel 2004"
         Let MyPain = "Task Pane"
        Else
         Let MyPain = "Office Clipboard"
        End If    
        Set avAcc = Application.CommandBars(MyPain )  ' ("Office Clipboard")
            bClipboard = avAcc.Visible
            If Not bClipboard Then
                avAcc.Visible = True
                DoEvents
            End If
            For j = 1 To 4
                AccessibleChildren avAcc, Choose(j, 0, 3, 0, 3), 1, avAcc, 1
            Next
            avAcc.accDoDefaultAction 2& '1& for paste
            Application.CommandBars(MyPain ). Visible = bClipboard    '   ("Office Clipboard").Visible = bClipboard
    End Sub


    Yaz: I have tested the code and I got the Clipboard window open then I got Invalid procedure call (Error '5') at this line

    avAcc.accDoDefaultAction 2& '1& for paste


    Alan 2024: Works Office 2007 2010 2013
    For 2003 to work added the MyPain stuff
    For Office 2016, same as Yasser, Runtime error '5'
    Ungültiger Prozeduraufruf oder ungültiges Argument, and his other finding too



    Jaf: Strange ! Are you using an arabic edition of office ?

    Try experimenting with :

    avAcc.accDoDefaultAction 0&

    and if the above doesn't work try this :

    avAcc.accDoDefaultAction 1&

    Yaz: I tried 1& and this throws error too ...
    Then I tried &0 and this doesn't throw any error .. But when have a look at the clipboard, I found it not clear

    I am using Office 2016 32Bit (English version)
    Last edited by DocAElstein; 10-06-2024 at 10:05 PM.

Similar Threads

  1. Table Tests. And Thread Copy Tests No Reply needed
    By DocAElstein in forum Test Area
    Replies: 1
    Last Post: 11-20-2018, 01:11 PM
  2. Table Tests. And Thread Copy Tests No Reply needed
    By DocAElstein in forum Test Area
    Replies: 1
    Last Post: 11-20-2018, 01:11 PM
  3. Replies: 11
    Last Post: 10-13-2013, 10:53 PM
  4. Replies: 1
    Last Post: 09-14-2013, 12:49 PM
  5. Replies: 7
    Last Post: 08-28-2013, 12:57 AM

Posting Permissions

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