我想列出Excel Chart对象的所有属性,但发现一个解决方案的问题:获取对象的所有属性的列表,但此解决方案似乎在Windows 10上不起作用(而且我认为它不起作用在Windows 7上)。用于TypeLib信息的dll显然与Windows 10不兼容。
我使用Office 2003、2010和2013,以及Windows 7和10。如果有建议,请指定您建议的解决方案已在哪个版本上测试或有望在哪个版本上使用。
我还没有找到VBA的答案,但是在AutoIt autoit中可以执行类似的操作(要求您在对象浏览器中选择第一个属性(例如,选择“激活”图表对象)。
#include <GuiListBox.au3>
_ReadItems()
Func _ReadItems()
const $delay=100
;;get handle to Object Browser window
$hwnd=WinWait("Microsoft Visual Basic - Book1 - [Object Browser]")
;;get handle to Object list box
Local $hLB = ControlGetHandle($hwnd,"","[CLASS:ListBox; INSTANCE:3]")
;;get handle to "property information box"
Local $hInfo= ControlGetHandle($hwnd,"","[CLASS:RichEdit20A; INSTANCE:1]")
Local $sMsg = ""
Local $text=""
;; loop through all items in list
Local $iCnt =_GUICtrlListBox_GetCount ( $hLB )
For $n = 0 To $iCnt - 1
sleep($delay)
;;copy text in information box
ControlFocus($hWnd, "",$hInfo)
sleep($delay)
send("^a")
sleep($delay)
send("^c")
sleep($delay)
$text= ClipGet()
;;move down in object list box
send("+{TAB}")
sleep($delay)
send("{DOWN}")
;;add information to result string
$sMsg &= $text & @CRLF
Next
;;put result on clipboard
ClipPut($sMsg)
EndFunc ;==>_ReadItems
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句