Results 1 to 10 of 565

Thread: Tests Copying, Pasting, API Cliipboard issues. and Rough notes on Advanced API stuff

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #11
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,521
    Rep Power
    10

    Things related to API - Jaafar Tribak - Clipboard stuff

    Things related to API - Jaafar Tribak - Clipboard stuff
    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 - I mean here what I am writing now
    Yassers comments/ posts are the green ones
    Yaz: ………

    , Jaafar Tribak’s suggestions are normal black
    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 in purple
    Alan 2024: …..






    Jaf: Trys this (This seems to be the first occurrence of what I will call the small one )
    Code:
         ' new small one first occurrance we missed in 2019 at mrexcel    https://www.mrexcel.com/board/threads/reset-clear-clipboard.1087948/#post-5228633
    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 small_2019_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
    (We all seem to have missed this in 2019, this new
    small one, which would appear for versions 2013 and lower to work as well as the big ones

    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-28-2024 at 02:36 PM.

Similar Threads

  1. Some Date Notes and Tests
    By DocAElstein in forum Test Area
    Replies: 5
    Last Post: 03-26-2025, 02:56 AM
  2. Replies: 116
    Last Post: 02-23-2025, 12:13 AM
  3. Replies: 21
    Last Post: 12-15-2024, 07:13 PM
  4. Replies: 42
    Last Post: 05-29-2023, 01:19 PM
  5. Replies: 11
    Last Post: 10-13-2013, 10:53 PM

Posting Permissions

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