Jaafar’s got a big one, but it doesn’t work for Excel 2016? Why?This page 18 from post 171 / 18036 is for some notes to possibly help in getting this big macro to also work for Office 2016 and higher
Jaafar’s got a big one, but it doesn’t work for Excel 2016? Why?This page 18 from post 171 / 18036 is for some notes to possibly help in getting this big macro to also work for Office 2016 and higher
Last edited by DocAElstein; 11-07-2024 at 09:35 PM.
This is post #172
https://www.excelfox.com/forum/showt...ge18#post18037
https://www.excelfox.com/forum/showthread.php/2824-Tests-Copying-pasting-Cliipboard-issues/page18#post18037
https://www.excelfox.com/forum/showt...ll=1#post18037
https://www.excelfox.com/forum/showthread.php/2824-Tests-Copying-pasting-Cliipboard-issues?p=18037&viewfull=1#post18037
Some pics for these postings, amongst other things:
https://stackoverflow.com/questions/...37321#79137321
https://stackoverflow.com/questions/...37208#79137208
https://eileenslounge.com/viewtopic....cee8b7#p321817 https://eileenslounge.com/viewtopic....321817#p321817
https://eileenslounge.com/viewtopic....321822#p321822
Offices Clipboard Viewer Clear All Button.JPG
https://postimg.cc/zHyFf6w2
https://i.postimg.cc/j2XgMrDT/Office...All-Button.jpg
See also https://www.excelfox.com/forum/showt...ll=1#post24324
Last edited by DocAElstein; 10-30-2024 at 12:57 PM.
This is post #173
https://www.excelfox.com/forum/showt...e18#post 18038
https://www.excelfox.com/forum/showthread.php/2824-Tests-Copying-pasting-Cliipboard-issues/page18#post 18038
https://www.excelfox.com/forum/showt...l=1#post 18038
https://www.excelfox.com/forum/showthread.php/2824-Tests-Copying-pasting-Cliipboard-issues?p= 18038&viewfull=1#post 18038
Some pics for these postings, amongst other things:
https://stackoverflow.com/questions/...37321#79137321
https://stackoverflow.com/questions/...37208#79137208
https://eileenslounge.com/viewtopic....cee8b7#p321817 https://eileenslounge.com/viewtopic....321817#p321817
https://eileenslounge.com/viewtopic....321822#p321822
http://www.eileenslounge.com/viewtopic.php?f=18&t=41566
https://www.excelfox.com/forum/showt...ll=1#post18039
Some pics of the Office’s Clipboard Viewer in different versions, (Seen in Excel)
https://i.postimg.cc/vmNJGfNg/Excel-...wer-XL2003.jpgAttachment 6090
https://i.postimg.cc/T18BDGGT/Excel-...wer-XL2007.jpgAttachment 6091
https://i.postimg.cc/cHtVCCpD/Excel-...wer-XL2010.jpgAttachment 6092
https://i.postimg.cc/Jh0wwPPC/Excel-...wer-XL2013.jpgAttachment 6094
https://i.postimg.cc/y8V4jVRd/Excel-...wer-XL2016.jpgAttachment 6093
Last edited by DocAElstein; 11-05-2024 at 09:47 PM.
This is post #174
https://www.excelfox.com/forum/showt...e18#post 18039
https://www.excelfox.com/forum/showthread.php/2824-Tests-Copying-pasting-Cliipboard-issues/page18#post 18039
https://www.excelfox.com/forum/showt...l=1#post 18039
https://www.excelfox.com/forum/showthread.php/2824-Tests-Copying-pasting-Cliipboard-issues?p= 18039&viewfull=1#post 18039
Spy++
If you Google around for things like Microsoft Windows Spy++ and / or alternatives to that, then you will get some software offered that tells you some things about what is going on in windows. As part of trying to get clued up on things API and clipboard, I have looked at a small part of the explorer/tree like thing presented by such software around an Excel File, in particular to see if I can get any useful info about the Offices Clipboard Viewer, ( the thing pictured in the previous 2 posts above,
https://www.excelfox.com/forum/showt...ll=1#post18037
https://www.excelfox.com/forum/showt...ll=1#post18038 )
The following pics are in pairs for some different Office versions. The left is for before and the right for after, opening the OfficesClipboardViewer
Excel 2003
https://i.postimg.cc/SKGKFhkG/Excel-...ard-Viewer.jpg Excel 2003 Spy the OfficesClipboardViewer.jpg
https://i.postimg.cc/SsskBYZy/XL-200...ard-Viewer.jpg -------------------- https://i.postimg.cc/YS8tDzzn/XL-200...ard-Viewer.jpg
Excel 2007
https://i.postimg.cc/tgbgMTQT/Excel-...ard-Viewer.jpg Excel 2007 Spy the OfficesClipboardViewer.jpg
https://i.postimg.cc/QCKstGGw/XL-200...ard-Viewer.jpg ----------------------- https://i.postimg.cc/zBc88DMT/XL-200...ard-Viewer.jpg
Excel 2010
Excel 2013
https://i.postimg.cc/RCYZzG52/Excel-...ard-Viewer.jpg Excel 2013 Spy the OfficesClipboardViewer.jpg
https://i.postimg.cc/c4841YdC/XL-201...ard-Viewer.jpg ------------------------------------- https://i.postimg.cc/4xk4Yd35/XL-201...ard-Viewer.jpg
Excel 2016
https://i.postimg.cc/sxMfhGSn/Excel-...ard-Viewer.jpg Excel 2016 Spy the OfficesClipboardViewer.jpg
https://i.postimg.cc/W1GNgvFP/XL-201...ard-Viewer.jpg --------------------- https://i.postimg.cc/7LqxNW0J/XL-201...ard-Viewer.jpg
Last edited by DocAElstein; 11-06-2024 at 12:37 AM.
related to the last few posts…
Some of the "Spy++" software allows you to drag a crosswire thingy into a window, and then you will likely get information about the window dragged into
( https://i.postimg.cc/ncBN23Rx/Drag-a...o-a-window.jpg
https://i.postimg.cc/XqPJHk4S/drag-i...wer-Window.jpg
https://i.postimg.cc/VsHhD1KM/XL-200...L9-Unicode.jpg )
If we do that for different version it may be telling us something about a change at Office 2016
Excel 2003
https://i.postimg.cc/vmLjzVKH/XL-200...L9-Unicode.jpg XL 2003 drag into bosa_sdm_XL9 (Unicode).jpg
Excel 2007
https://i.postimg.cc/WbQz0850/XL-200...L9-Unicode.jpg XL 2007 drag into bosa_sdm_XL9 (Unicode).JPG
Excel 2010
Excel 2013
https://i.postimg.cc/y8cdjRGt/XL-201...fuegen-2-0.jpg XL 2013 drag into bosa_sdm_XL9 (Unicode) Zusammenstellen und Einfuegen 2 0.jpg
Excel 2016
https://i.postimg.cc/HsJjJR9p/XL-201...ND-Unicode.jpg XL 2016 drag into NetUIHWND (Unicode).JPG
Last edited by DocAElstein; 11-06-2024 at 01:31 AM.
The last post inspired me a bit to take another look at this snippet.
I did some modifications to help take a closer lookCode:Let hwndClip = FindWindowEx(Application.hWnd, 0, "EXCEL2", vbNullString) Let hwndClip = FindWindowEx(hwndClip, 0, "MsoCommandBar", CommandBars(MyPain).NameLocal) Let hwndClip = GetNextWindow(hwndClip, GW_CHILD) Let hwndScrollBar = GetNextWindow(GetNextWindow(hwndClip, GW_CHILD), GW_CHILD) If hwndClip And hwndScrollBar Then GetWindowRect hwndClip, tRect1 GetWindowRect hwndScrollBar, tRect2 BringWindowToTop Application.hWnd For i = 0 To tRect1.Right - tRect1.Left Step 50 tPt.x = tRect1.Left + i: tPt.Y = tRect1.Top - 10 + (tRect2.Top - tRect1.Top) / 2 #If VBA7 And Win64 Then CopyMemory lngPtr, tPt, LenB(tPt) Let lResult = AccessibleObjectFromPoint(lngPtr, oIA, vKid) #Else Let lResult = AccessibleObjectFromPoint(tPt.x, tPt.Y, oIA, vKid) #End If ' If InStr("Clear All Borrar todo Effacer tout Alle löschen La légende du bouton", oIA.accName(vKid)) Then Call oIA.accDoDefaultAction(vKid) ' This does the clearing, and CommandBars(MyPain).Visible = Not bHidden ' Let bHidden = False Exit Sub End If DoEvents Next i End If
(The modifications are
_ 1) a small change to prevent the code erroring if finds a button or something without any caption
_2) some Debug.Print lines )
Here is the modified versionCode:' 1180958 Let hwndClip = FindWindowEx(Application.hwnd, 0, "EXCEL2", vbNullString): Debug.Print "hwndClip " & hwndClip Let hwndClip = FindWindowEx(hwndClip, 0, "MsoCommandBar", CommandBars(MyPain).NameLocal): Debug.Print "hwndClip " & hwndClip ' 591464 Let hwndClip = GetNextWindow(hwndClip, GW_CHILD): Debug.Print "hwndClip " & hwndClip ' 721906 Let hwndScrollBar = GetNextWindow(GetNextWindow(hwndClip, GW_CHILD), GW_CHILD): Debug.Print "hwndScrollBar " & hwndScrollBar ' 787440 Debug.Print If hwndClip And hwndScrollBar Then GetWindowRect hwndClip, tRect1 GetWindowRect hwndScrollBar, tRect2 BringWindowToTop Application.hwnd Debug.Print " tRect1.Top = " & tRect1.Top & " tRect2.Top = " & tRect2.Top Debug.Print "( tRect1.Bottom = " & tRect1.Bottom & " tRect2.Bottom = " & tRect2.Bottom & " )" Debug.Print "Loop i from 0 To (" & tRect1.Right & "-" & tRect1.Left & ")=" & tRect1.Right - tRect1.Left & " Step 50" For i = 0 To tRect1.Right - tRect1.Left Step 50 Let tPt.x = tRect1.Left + i Let tPt.Y = tRect1.Top - 10 + (tRect2.Top - tRect1.Top) / 2: Debug.Print "i=" & Format(i, "000") & " tPt.x = " & tPt.x & " tPt.Y = " & tPt.Y #If VBA7 And Win64 Then CopyMemory lngPtr, tPt, LenB(tPt) Let lResult = AccessibleObjectFromPoint(lngPtr, oIA, vKid) #Else Let lResult = AccessibleObjectFromPoint(tPt.x, tPt.Y, oIA, vKid) #End If ' Debug.Print "lResult " & lResult & " vKid " & vKid & " oIA.accName(vKid) """ & oIA.accName(vKid) & """" If oIA.accName(vKid) <> "" And InStr("Clear All Borrar todo Effacer tout Alle löschen La légende du bouton", oIA.accName(vKid)) > 0 Then Call oIA.accDoDefaultAction(vKid) ' This does the clearing, and CommandBars(MyPain).Visible = Not bHidden ' Let bHidden = False Debug.Print "Worked, :-)" Stop: Exit Sub End If DoEvents Next i End If Let CommandBars(MyPain).Visible = Not bHidden Debug.Print "Unable to clear the Office Clipboard, didn't work, :-(" Stop End Sub
Results in the next two posts
https://www.excelfox.com/forum/showt...ll=1#post18042
https://www.excelfox.com/forum/showt...ll=1#post18043
Last edited by DocAElstein; 11-07-2024 at 07:05 PM.
Here are the results for Office 2003 2007 2010 2013, they are similar, and note that for those office versions, 2003 2007 2010 2013, the big coding does what we want (** when run ) and all is well
( ** when stepped through in debug F8 mode from the VBEditor , some versions do not work )
2003
https://i.postimg.cc/8CgCckTn/XL-200...ons-on-Run.jpgXL 2003 WinSpy & Dimensions on Run.jpg
Code:' Excel 2003 Klaus Notebook ' Results from Immediate window when Run the code, (from Excel or from the VBEditor) ' hwndClip 25888836 ' hwndClip 29427046 ' hwndClip 460018 ' hwndScrollBar 656320 ' ' tRect1.Top = 232 tRect2.Top = 295 ' ( tRect1.Bottom = 436 tRect2.Bottom = 376 ) ' Loop i from 0 To (853-653)=200 Step 50 ' i=000 tPt.x = 653 tPt.Y = 254 ' lResult 0 vKid 0 oIA.accName(vKid) "Zusammenstellen und Einfügen 2.0" ' i=050 tPt.x = 703 tPt.Y = 254 ' lResult 0 vKid 1 oIA.accName(vKid) "Alle einfügen" ' i=100 tPt.x = 753 tPt.Y = 254 ' lResult 0 vKid 0 oIA.accName(vKid) "Zusammenstellen und Einfügen 2.0" ' i=150 tPt.x = 803 tPt.Y = 254 ' lResult 0 vKid 2 oIA.accName(vKid) "Alle löschen" ' Worked, :-) ' ' Results from Immediate window when step debug mode from the VBEditor ' hwndClip 25888836 ' hwndClip 29427046 ' hwndClip 460018 ' hwndScrollBar 656320 ' ' tRect1.Top = 232 tRect2.Top = 295 ' ( tRect1.Bottom = 436 tRect2.Bottom = 376 ) ' Loop i from 0 To (853-653)=200 Step 50 ' i=000 tPt.x = 653 tPt.Y = 254 ' lResult 0 vKid 0 oIA.accName(vKid) "OfficesClipboardViewerTests (Code)" ' i=050 tPt.x = 703 tPt.Y = 254 ' lResult 0 vKid 0 oIA.accName(vKid) "OfficesClipboardViewerTests (Code)" ' i=100 tPt.x = 753 tPt.Y = 254 ' lResult 0 vKid 0 oIA.accName(vKid) "OfficesClipboardViewerTests (Code)" ' i=150 tPt.x = 803 tPt.Y = 254 ' lResult 0 vKid 0 oIA.accName(vKid) "OfficesClipboardViewerTests (Code)" ' i=200 tPt.x = 853 tPt.Y = 254 ' lResult 0 vKid 0 oIA.accName(vKid) "OfficesClipboardViewerTests (Code)" ' Unable to clear the Office Clipboard, didn't work, :-( ' ------------------------------------------------------------------------------------------------------- ' Excel 2003 KB ' Results from Immediate window when Run the code, (from Excel or from the VBEditor) ' hwndClip 4785806 ' hwndClip 722274 ' hwndClip 2492028 ' hwndScrollBar 6096064 ' ' tRect1.Top = -782 tRect2.Top = -719 ' ( tRect1.Bottom = -73 tRect2.Bottom = -179 ) ' Loop i from 0 To (1534-1334)=200 Step 50 ' i=000 tPt.x = 1334 tPt.Y = -760 ' lResult 0 vKid 0 oIA.accName(vKid) "Zusammenstellen und Einfügen 2.0" ' i=050 tPt.x = 1384 tPt.Y = -760 ' lResult 0 vKid 1 oIA.accName(vKid) "Alle einfügen" ' i=100 tPt.x = 1434 tPt.Y = -760 ' lResult 0 vKid 0 oIA.accName(vKid) "Zusammenstellen und Einfügen 2.0" ' i=150 tPt.x = 1484 tPt.Y = -760 ' lResult 0 vKid 2 oIA.accName(vKid) "Alle löschen" ' Worked, :-) ' Results from Immediate window when step debug mode from the VBEditor ' hwndClip 4785806 ' hwndClip 722274 ' hwndClip 2492028 ' hwndScrollBar 6096064 ' ' tRect1.Top = -782 tRect2.Top = -719 ' ( tRect1.Bottom = -73 tRect2.Bottom = -179 ) ' Loop i from 0 To (1534-1334)=200 Step 50 ' i=000 tPt.x = 1334 tPt.Y = -760 ' lResult 0 vKid 0 oIA.accName(vKid) "Direktbereich" ' i=050 tPt.x = 1384 tPt.Y = -760 ' lResult 0 vKid 0 oIA.accName(vKid) "Direktbereich" ' i=100 tPt.x = 1434 tPt.Y = -760 ' lResult 0 vKid 0 oIA.accName(vKid) "Direktbereich" ' i=150 tPt.x = 1484 tPt.Y = -760 ' lResult 0 vKid 0 oIA.accName(vKid) "Direktbereich" ' i=200 tPt.x = 1534 tPt.Y = -760 ' lResult 0 vKid 0 oIA.accName(vKid) "Direktbereich" ' Unable to clear the Office Clipboard, didn't work, :-( ' Some stuff copied from the spy after dragging into OfficesViewerPane ' Caption: Zusammenstellen und Einfügen 2.0 ' Class: bosa_sdm_XL9 (Unicode) ' Rectangle: (1334,-782) - (1534,-73) - 200x709 ' Client Rect: (0,0) - (200,709) - 200x709 ' '
2007
https://i.postimg.cc/XvKYCMJN/XL-200...ons-on-Run.jpg XL 2007 WinSpy & Dimensions on Run.jpg
Code:' Excel 2007 Klaus Notebook ' Results from Immediate window when Run the code, (from Excel or from the VBEditor) ' hwndClip 20579580 ' hwndClip 29689006 ' hwndClip 460302 ' hwndScrollBar 722120 ' ' tRect1.Top = 206 tRect2.Top = 256 ' ( tRect1.Bottom = 579 tRect2.Bottom = 541 ) ' Loop i from 0 To (231-37)=194 Step 50 ' i=000 tPt.x = 37 tPt.Y = 221 ' lResult 0 vKid 0 oIA.accName(vKid) "Collect and Paste 2.0" ' i=050 tPt.x = 87 tPt.Y = 221 ' lResult 0 vKid 1 oIA.accName(vKid) "Paste All" ' i=100 tPt.x = 137 tPt.Y = 221 ' lResult 0 vKid 2 oIA.accName(vKid) "Clear All" ' Worked, :-) ' ' Results from Immediate window when step debug mode from the VBEditor ' hwndClip 20579580 ' hwndClip 29689006 ' hwndClip 460302 ' hwndScrollBar 722120 ' ' tRect1.Top = 206 tRect2.Top = 256 ' ( tRect1.Bottom = 579 tRect2.Bottom = 541 ) ' Loop i from 0 To (231-37)=194 Step 50 ' i=000 tPt.x = 37 tPt.Y = 221 ' lResult 0 vKid 0 oIA.accName(vKid) "Collect and Paste 2.0" ' i=050 tPt.x = 87 tPt.Y = 221 ' lResult 0 vKid 1 oIA.accName(vKid) "Paste All" ' i=100 tPt.x = 137 tPt.Y = 221 ' lResult 0 vKid 2 oIA.accName(vKid) "Clear All" ' Worked, :-) ' Some stuff copied from the spy after dragging into OfficesViewerPane ' Caption: Zusammenstellen und Einfügen 2.0 ' Class: bosa_sdm_XL9 (Unicode) ' Rectangle: (37,206) - (231,579) - 194x373 ' Client Rect: (0,0) - (194,373) - 194x373 ' ------------------------------------------------------------------------------------------------------- ' ' Excel 2007 KB ' Results from Immediate window when Run the code, (from Excel or from the VBEditor) ' tRect1.Top = -711 tRect2.Top = -661 ' ( tRect1.Bottom = -193 tRect2.Bottom = -229 ) ' Loop i from 0 To (1434-1207)=227 Step 50 ' i=000 tPt.x = 1207 tPt.Y = -696 ' lResult 0 vKid 0 oIA.accName(vKid) "Collect and Paste 2.0" ' i=050 tPt.x = 1257 tPt.Y = -696 ' lResult 0 vKid 1 oIA.accName(vKid) "Paste All" ' i=100 tPt.x = 1307 tPt.Y = -696 ' lResult 0 vKid 2 oIA.accName(vKid) "Clear All" ' Worked, :-) ' Results from Immediate window when step debug mode from the VBEditor ' tRect1.Top = -725 tRect2.Top = -675 ' ( tRect1.Bottom = -159 tRect2.Bottom = -195 ) ' Loop i from 0 To (1019-792)=227 Step 50 ' i=000 tPt.x = 792 tPt.Y = -710 ' lResult 0 vKid 0 oIA.accName(vKid) "Collect and Paste 2.0" ' i=050 tPt.x = 842 tPt.Y = -710 ' lResult 0 vKid 1 oIA.accName(vKid) "Paste All" ' i=100 tPt.x = 892 tPt.Y = -710 ' lResult 0 vKid 2 oIA.accName(vKid) "Clear All" ' Worked, :-) ' Some stuff copied from the spy after dragging into OfficesViewerPane ' Caption: Collect and Paste 2.0 ' Class: bosa_sdm_XL9 (Unicode) ' Rectangle: (1207,-711) - (1434,-193) - 227x518 ' Client Rect: (0,0) - (227,518) - 227x518
2010
https://i.postimg.cc/023jgdFv/XL-201...ons-on-Run.jpg XL 2010 WinSpy & Dimensions on Run.jpg
Code:' Excel 2010 Klaus Notebook ' hwndClip 329404 ' hwndClip 329350 ' hwndClip 394808 ' hwndScrollBar 329338 ' ' tRect1.Top = 209 tRect2.Top = 259 ' ( tRect1.Bottom = 569 tRect2.Bottom = 534 ) ' Loop i from 0 To (773-479)=294 Step 50 ' i=000 tPt.x = 479 tPt.Y = 224 ' lResult 0 vKid 0 oIA.accName(vKid) "Zusammenstellen und Einfügen 2.0" ' i=050 tPt.x = 529 tPt.Y = 224 ' lResult 0 vKid 1 oIA.accName(vKid) "Alle einfügen" ' i=100 tPt.x = 579 tPt.Y = 224 ' lResult 0 vKid 0 oIA.accName(vKid) "Zusammenstellen und Einfügen 2.0" ' i=150 tPt.x = 629 tPt.Y = 224 ' lResult 0 vKid 2 oIA.accName(vKid) "Alle löschen" ' Worked, :-) ' ' Results from Immediate window when step debug mode from the VBEditor ' hwndClip 329404 ' hwndClip 329350 ' hwndClip 394808 ' hwndScrollBar 329338 ' ' tRect1.Top = 209 tRect2.Top = 259 ' ( tRect1.Bottom = 569 tRect2.Bottom = 534 ) ' Loop i from 0 To (773-479)=294 Step 50 ' i=000 tPt.x = 479 tPt.Y = 224 ' lResult 0 vKid 0 oIA.accName(vKid) "Projektfenster" ' i=050 tPt.x = 529 tPt.Y = 224 ' lResult 0 vKid 0 oIA.accName(vKid) "OfficesClipboardViewerTests (Code)" ' i=100 tPt.x = 579 tPt.Y = 224 ' lResult 0 vKid 0 oIA.accName(vKid) "OfficesClipboardViewerTests (Code)" ' i=150 tPt.x = 629 tPt.Y = 224 ' lResult 0 vKid 0 oIA.accName(vKid) "OfficesClipboardViewerTests (Code)" ' i=200 tPt.x = 679 tPt.Y = 224 ' lResult 0 vKid 0 oIA.accName(vKid) "OfficesClipboardViewerTests (Code)" ' i=250 tPt.x = 729 tPt.Y = 224 ' lResult 0 vKid 0 oIA.accName(vKid) "OfficesClipboardViewerTests (Code)" ' Unable to clear the Office Clipboard, didn't work, :-( ' Some stuff copied from the spy after dragging into OfficesViewerPane ' Caption: Zusammenstellen und Einfügen 2.0 ' Class: bosa_sdm_XL9 (Unicode) ' Rectangle: (479,209) - (773,569) - 294x360 ' Client Rect: (0,0) - (294,360) - 294x360 ' ------------------------------------------------------------------------------------------------------- ' ' Excel 2010 Elfy ' Results from Immediate window when Run the code, (from Excel or from the VBEditor) ' hwndClip 461200 ' hwndClip 264628 ' hwndClip 264678 ' hwndScrollBar 330140 ' tRect1.Top = 224 tRect2.Top = 274 ' ( tRect1.Bottom = 819 tRect2.Bottom = 778 ) ' Loop i from 0 To (808-514)=294 Step 50 ' i=000 tPt.x = 514 tPt.Y = 239 ' lResult 0 vKid 0 oIA.accName(vKid) "Zusammenstellen und Einfügen 2.0" ' i=050 tPt.x = 564 tPt.Y = 239 ' lResult 0 vKid 1 oIA.accName(vKid) "Alle einfügen" ' i=100 tPt.x = 614 tPt.Y = 239 ' lResult 0 vKid 0 oIA.accName(vKid) "Zusammenstellen und Einfügen 2.0" ' i=150 tPt.x = 664 tPt.Y = 239 ' lResult 0 vKid 2 oIA.accName(vKid) "Alle löschen" ' Worked, :-) ' Results from Immediate window when step debug mode from the VBEditor ' hwndClip 461200 ' hwndClip 264628 ' hwndClip 264678 ' hwndScrollBar 330140 ' ' tRect1.Top = 224 tRect2.Top = 274 ' ( tRect1.Bottom = 819 tRect2.Bottom = 778 ) ' Loop i from 0 To (808-514)=294 Step 50 ' i=000 tPt.x = 514 tPt.Y = 239 ' lResult 0 vKid 0 oIA.accName(vKid) "OfficesClipboardViewerTests (Code)" ' i=050 tPt.x = 564 tPt.Y = 239 ' lResult 0 vKid 0 oIA.accName(vKid) "OfficesClipboardViewerTests (Code)" ' i=100 tPt.x = 614 tPt.Y = 239 ' lResult 0 vKid 0 oIA.accName(vKid) "OfficesClipboardViewerTests (Code)" ' i=150 tPt.x = 664 tPt.Y = 239 ' lResult 0 vKid 0 oIA.accName(vKid) "OfficesClipboardViewerTests (Code)" ' i=200 tPt.x = 714 tPt.Y = 239 ' lResult 0 vKid 0 oIA.accName(vKid) "OfficesClipboardViewerTests (Code)" ' i=250 tPt.x = 764 tPt.Y = 239 ' lResult 0 vKid 0 oIA.accName(vKid) "OfficesClipboardViewerTests (Code)" ' Unable to clear the Office Clipboard, didn't work, :-( ' Some stuff copied from the spy after dragging into OfficesViewerPane ' Caption: Zusammenstellen und Einfügen 2.0 ' Class: bosa_sdm_XL9 (Unicode) ' Rectangle: (347,205) - (641,800) - 294x595 ' Client Rect: (0,0) - (294,595) - 294x595
2013
https://i.postimg.cc/0ywQ9K1w/XL-201...ons-on-Run.jpg XL 2013 WinSpy & Dimensions on Run.jpg
Code:Results from Immediate window ' tRect1.Top = -327 tRect2.Top = -239 ' ( tRect1.Bottom = 6 tRect2.Bottom = -29 ) ' Loop i from 0 To (2174-1990)=184 Step 50 ' i=000 tPt.x = 1990 tPt.Y = -293 ' lResult 0 vKid 0 oIA.accName(vKid) "Zusammenstellen und Einfügen 2.0" ' i=050 tPt.x = 2040 tPt.Y = -293 ' lResult 0 vKid 2 oIA.accName(vKid) "Alle löschen" ' Worked, :-) Some stuff copied from the spy after dragging into OfficesViewerPane ' Caption: Zusammenstellen und Einfügen 2.0 ' Class: bosa_sdm_XL9 (Unicode) ' Rectangle: (1990,-327) - (2174,136) - 184x463 ' Client Rect: (0,0) - (184,463) - 184x463
Last edited by DocAElstein; 11-08-2024 at 10:15 PM.
Compared to the results for Offices 2003 2007 2010 and 2013 in the previous post, the results here for Office 2016 look a bit screwy.
https://i.postimg.cc/Y2djRwxh/XL-201...ons-on-Run.jpg
Results from Immediate window when Run the code, (from Excel or from the VBEditor)
Results from Immediate window when step debug mode from the VBEditorCode:' Running the coding:- ' hwndClip 939260 ' hwndClip 676872 ' hwndClip 1003964 ' hwndScrollBar 610674 ' ' tRect1.Top = 489 tRect2.Top = 489 ' ( tRect1.Bottom = 1064 tRect2.Bottom = 1064 ) ' Loop i from 0 To (989-733)=256 Step 50 ' i=000 tPt.x = 733 tPt.Y = 479 ' lResult 0 vKid 0 oIA.accName(vKid) "" ' i=050 tPt.x = 783 tPt.Y = 479 ' lResult 0 vKid 0 oIA.accName(vKid) "" ' i=100 tPt.x = 833 tPt.Y = 479 ' lResult 0 vKid 0 oIA.accName(vKid) "" ' i=150 tPt.x = 883 tPt.Y = 479 ' lResult 0 vKid 0 oIA.accName(vKid) "" ' i=200 tPt.x = 933 tPt.Y = 479 ' lResult 0 vKid 0 oIA.accName(vKid) "Optionen für den Aufgabenbereich" ' i=250 tPt.x = 983 tPt.Y = 479 ' lResult 0 vKid 0 oIA.accName(vKid) "" ' Unable to clear the Office Clipboard, didn't work, :-(
Code:' Doing the coding in step debug mode ' hwndClip 939260 ' hwndClip 676872 ' hwndClip 1003964 ' hwndScrollBar 610674 ' ' tRect1.Top = 489 tRect2.Top = 489 ' ( tRect1.Bottom = 1064 tRect2.Bottom = 1064 ) ' Loop i from 0 To (989-733)=256 Step 50 ' i=000 tPt.x = 733 tPt.Y = 479 ' lResult 0 vKid 0 oIA.accName(vKid) "OfficesClipboardViewerTests (Code)" ' i=050 tPt.x = 783 tPt.Y = 479 ' lResult 0 vKid 0 oIA.accName(vKid) "OfficesClipboardViewerTests (Code)" ' i=100 tPt.x = 833 tPt.Y = 479 ' lResult 0 vKid 0 oIA.accName(vKid) "OfficesClipboardViewerTests (Code)" ' i=150 tPt.x = 883 tPt.Y = 479 ' lResult 0 vKid 0 oIA.accName(vKid) "OfficesClipboardViewerTests (Code)" ' i=200 tPt.x = 933 tPt.Y = 479 ' lResult 0 vKid 0 oIA.accName(vKid) "Direktbereich" ' i=250 tPt.x = 983 tPt.Y = 479 ' lResult 0 vKid 0 oIA.accName(vKid) "Direktbereich" ' Unable to clear the Office Clipboard, didn't work, :-( '
Some stuff copied from the spy after dragging into OfficesViewerPane
Code:' Caption: NO Caption!!! ' Class: NetUIHWND (Unicode) ' Rectangle: (740,361) - (996,936) - 256x575 ' (733,489) - (989,1064) - 256x575 ' Client Rect: (0,0) - (256,575) - 256x575 '
Last edited by DocAElstein; 11-08-2024 at 10:13 PM.
Some tests on the small codings
Some simple test based on this modified coding:
The results for the small codings are more consistent, and there is no strange problem of different results when done in step debug modeCode:Sub small_20202024_ClearOfficeClipBoard_Tests() ' https://www.excelfox.com/forum/showthread.php/2824-Tests-Copying-pasting-Cliipboard-issues-and-otes-on-API-stuff?p=18044&viewfull=1#post18044 Dim avAcc, bClipboard As Boolean, j As Long, x 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 Debug.Print "j " & j & " "; Debug.Print "0&" & " " & avAcc.accName(CLng(0)); On Error Resume Next Debug.Print " 1&" & " " & avAcc.accName(CLng(1)); Debug.Print " 2&" & " " & avAcc.accName(CLng(2)); Debug.Print " 3&" & " " & avAcc.accName(CLng(3)); Debug.Print " 4&" & " " & avAcc.accName(CLng(4)); Debug.Print " 5&" & " " & avAcc.accName(CLng(5)); Debug.Print " 6&" & " " & avAcc.accName(CLng(6)); Debug.Print " 7&" & " " & avAcc.accName(CLng(7)); Debug.Print " 8&" & " " & avAcc.accName(CLng(8)); Debug.Print " 9&" & " " & avAcc.accName(CLng(9)) On Error GoTo 0 Debug.Print 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 Debug.Print "j " & j & " "; Debug.Print "0&" & " " & avAcc.accName(CLng(0)); On Error Resume Next Debug.Print " 1&" & " " & avAcc.accName(CLng(1)); Debug.Print " 2&" & " " & avAcc.accName(CLng(2)); Debug.Print " 3&" & " " & avAcc.accName(CLng(3)); Debug.Print " 4&" & " " & avAcc.accName(CLng(4)); Debug.Print " 5&" & " " & avAcc.accName(CLng(5)); Debug.Print " 6&" & " " & avAcc.accName(CLng(6)); Debug.Print " 7&" & " " & avAcc.accName(CLng(7)); Debug.Print " 8&" & " " & avAcc.accName(CLng(8)); Debug.Print " 9&" & " " & avAcc.accName(CLng(9)) On Error GoTo 0 Debug.Print 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
Here some results for Offices 2003 2007 2010 2013
Here the corresponding result for a Office 2016Code:' excel 2003 KB ' Run ' j 1 0& 1 von 24 - Zwischenablage ' j 2 0& 1 von 24 - Zwischenablage ' j 3 0& Zusammenstellen und Einfügen 2.0 ' j 4 0& Zusammenstellen und Einfügen 2.0 1& Alle einfügen 2& Alle löschen 3& Klicken Sie zum Einfügen auf ein Element: 4& Zwischenablage 5& Zwischenablage 6& Um diesen Aufgabenbereich später einzublenden, wählen Sie Office-Zwischenablage aus dem Menü Bearbeiten oder drücken Sie Strg+C zwei mal. 7& Optionen ' debug step from VBEditor ' j 1 0& Zwischenablage ' j 2 0& Zwischenablage ' j 3 0& Zusammenstellen und Einfügen 2.0 ' j 4 0& Zusammenstellen und Einfügen 2.0 1& Alle einfügen 2& Alle löschen 3& Klicken Sie zum Einfügen auf ein Element: 4& Zwischenablage 5& Zwischenablage 6& Um diesen Aufgabenbereich später einzublenden, wählen Sie Office-Zwischenablage aus dem Menü Bearbeiten oder drücken Sie Strg+C zwei mal. 7& Optionen ' ============================================================================================= ' Excel 2007 KB ' Run ' j 1 0& Clipboard ' j 2 0& Clipboard ' j 3 0& Collect and Paste 2.0 ' j 4 0& Collect and Paste 2.0 1& Paste All 2& Clear All 3& Click an item to paste: 4& Clipboard 5& Clipboard 6& Options ' ' Debug step from VBEditor ' j 1 0& Clipboard ' j 2 0& Clipboard ' j 3 0& Collect and Paste 2.0 ' j 4 0& Collect and Paste 2.0 1& Paste All 2& Clear All 3& Click an item to paste: 4& Clipboard 5& Clipboard 6& Options ' ' ======================================================================================================000 ' 2010 Elfy ' Run ' j 1 0& 1 von 24 - Zwischenablage ' j 2 0& 1 von 24 - Zwischenablage ' j 3 0& Zusammenstellen und Einfügen 2.0 ' j 4 0& Zusammenstellen und Einfügen 2.0 1& Alle einfügen 2& Alle löschen 3& Klicken Sie zum Einfügen auf ein Element: 4& Zwischenablage 5& Zwischenablage 6& Optionen ' ' step debug ' j 1 0& Zwischenablage ' j 2 0& Zwischenablage ' j 3 0& Zusammenstellen und Einfügen 2.0 ' j 4 0& Zusammenstellen und Einfügen 2.0 1& Alle einfügen 2& Alle löschen 3& Klicken Sie zum Einfügen auf ein Element: 4& Zwischenablage 5& Zwischenablage 6& Optionen ' ==================================================================================================== ' 2013 SerSzuD2 ' Run ' j 1 0& Zwischenablage ' j 2 0& Zwischenablage ' j 3 0& Zusammenstellen und Einfügen 2.0 ' j 4 0& Zusammenstellen und Einfügen 2.0 1& Alle einfügen 2& Alle löschen 3& Klicken Sie auf ein Element, um es einzufügen: 4& Zwischenablage 5& Zwischenablage 6& Optionen ' ' step debug ' j 1 0& Zwischenablage ' j 2 0& Zwischenablage ' j 3 0& Zusammenstellen und Einfügen 2.0 ' j 4 0& Zusammenstellen und Einfügen 2.0 1& Alle einfügen 2& Alle löschen 3& Klicken Sie auf ein Element, um es einzufügen: 4& Zwischenablage 5& Zwischenablage 6& Optionen
Code:' Excel 2016 Torrox ' Run ' j 1 0& Zwischenablage ' j 2 0& Zwischenablage ' j 3 0& ' j 4 0& ' j 5 0& Zwischenablage ' j 6 0& Zwischenablage ' j 7 0& Alle löschen ' ' Debug step ' j 1 0& Zwischenablage ' j 2 0& Zwischenablage ' j 3 0& ' j 4 0& ' j 5 0& Zwischenablage ' j 6 0& Zwischenablage ' j 7 0& Alle löschen
Last edited by DocAElstein; 11-09-2024 at 01:50 AM.
yvmccnvm
Last edited by DocAElstein; 10-29-2024 at 04:04 PM.
Bookmarks