Results 1 to 10 of 554

Thread: Tests Copying pasting Cliipboard issues. and otes on API stuff

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #40
    Fuhrer, Vierte Reich DocAElstein's Avatar
    Join Date
    Aug 2014
    Posts
    9,455
    Rep Power
    10
    This is post #554
    https://www.excelfox.com/forum/showt...ge56#post24879
    https://www.excelfox.com/forum/showthread.php/2824-Tests-Copying-pasting-Cliipboard-issues/page56#post24879
    https://www.excelfox.com/forum/showt...ll=1#post24879
    https://www.excelfox.com/forum/showthread.php/2824-Tests-Copying-pasting-Cliipboard-issues?p=24879 &viewfull=1#post24879




    This is my latest attempt as of October 2024 for a small coding version that will work across Office versions from 2003 up to the latest.
    For recent discussions, see here
    https://eileenslounge.com/viewtopic....321822#p321822

    https://eileenslounge.com/viewtopic....321817#p321817
    https://eileenslounge.com/viewtopic....321820#p321820
    https://eileenslounge.com/viewtopic....321821#p321821




    Code:
    Option Explicit      https://www.excelfox.com/forum/showthread.php/2824-Tests-Copying-pasting-Cliipboard-issues-and-otes-on-API-stuff?p=24879&viewfull=1#post24879
        #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_20202024_ClearOfficeClipBoard_()  ' https://eileenslounge.com/viewtopic.php?p=319159&sid=a5636ddee2213f0629c9f46423c324c5#p319159
    Dim avAcc, bClipboard As Boolean, j As Long
    Dim MyPain As String
        If CLng(Val(Application.Version)) <= 11 Then  '                   Case 11: "Excel 2003" Windows    "Excel 2004" mac
         Let MyPain = "Task Pane"
        Else
         Let MyPain = "Office Clipboard"
        End If
    Set avAcc = Application.CommandBars(MyPain)   '
    Let bClipboard = avAcc.Visible      '   bClipboard will be false if the viewer pain is not open
        If Not bClipboard Then
         avAcc.Visible = True           '   This opens the Viewer pain. The coding won't work if it is not open
         DoEvents: DoEvents
        Else
        End If
    '   coding change for Office versions at  --  Office 2016  ==
        If CLng(Val(Application.Version)) < 16 Then
    ' --For Office versions 2003 2007 2010 2013 ----------------------------------------
            For j = 1 To 4         '      J =    1  2  3  4
             AccessibleChildren avAcc, Choose(j, 0, 3, 0, 3), 1, avAcc, 1
            Next
         avAcc.accDoDefaultAction 2&  '           This seems to do the clearing   It will NOT error if viewer pain is already  Cleared                  1& for paste
    ' ----------------------------------------------------------------------------------
        Else
    ' ==For Office versions 2016 and higher ==============================================
            For j = 1 To 7      '           J =  1  2  3  4  5  6  7
             AccessibleChildren avAcc, Choose(j, 0, 3, 0, 3, 0, 3, 1), 1, avAcc, 1
            Next
         avAcc.accDoDefaultAction 0& '            This seems to do the clearing   It WILL error if viewer pain is already  Cleared
        End If ' =======================================================================
     Let Application.CommandBars(MyPain).Visible = bClipboard      '   Puts the viewer pain back as it was, open or closed
    End Sub
    Last edited by DocAElstein; 11-08-2024 at 10:32 PM.

Similar Threads

  1. Replies: 114
    Last Post: 03-04-2024, 02:39 PM
  2. Replies: 42
    Last Post: 05-29-2023, 01:19 PM
  3. Replies: 11
    Last Post: 10-13-2013, 10:53 PM
  4. Replies: 7
    Last Post: 08-28-2013, 12:57 AM
  5. Declaring API Functions In 64 Bit
    By marreco in forum Excel Help
    Replies: 2
    Last Post: 02-11-2013, 03:18 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
  •