跟我学VBA,我这里专注VBA, 授人以渔。我98年开始,从源码接触VBA已经20余年了,随着年龄的增长,越来越觉得有必要把这项技能传递给需要这项技术的职场人员。希望和数据打交道的朋友,都来学习VBA,利用VBA,起码可以提高自己的工作效率,可以有时间多陪陪父母,多陪陪家人,何乐而不为呢?这讲我们继续学习64位Office API声明语句学习之61讲,这些内容是MS的权威资料,看似枯燥,但对于想学习API函数的朋友是非常有用的。 ' Color TypesConst CTLCOLOR_MSGBOX = 0Const CTLCOLOR_EDIT = 1Const CTLCOLOR_LISTBOX = 2Const CTLCOLOR_BTN = 3Const CTLCOLOR_DLG = 4Const CTLCOLOR_SCROLLBAR = 5Const CTLCOLOR_STATIC = 6Const CTLCOLOR_MAX = 8 ' three bits max Const COLOR_SCROLLBAR = 0Const COLOR_BACKGROUND = 1Const COLOR_ACTIVECAPTION = 2Const COLOR_INACTIVECAPTION = 3Const COLOR_MENU = 4Const COLOR_WINDOW = 5Const COLOR_WINDOWFRAME = 6Const COLOR_MENUTEXT = 7Const COLOR_WINDOWTEXT = 8Const COLOR_CAPTIONTEXT = 9Const COLOR_ACTIVEBORDER = 10Const COLOR_INACTIVEBORDER = 11Const COLOR_APPWORKSPACE = 12Const COLOR_HIGHLIGHT = 13Const COLOR_HIGHLIGHTTEXT = 14Const COLOR_BTNFACE = 15Const COLOR_BTNSHADOW = 16Const COLOR_GRAYTEXT = 17Const COLOR_BTNTEXT = 18Const COLOR_INACTIVECAPTIONTEXT = 19Const COLOR_BTNHIGHLIGHT = 20 Declare PtrSafe Function GetSysColor Lib "user32" Alias "GetSysColor" (ByVal nIndex As Long) As LongDeclare PtrSafe Function SetSysColors Lib "user32" Alias "SetSysColors" (ByVal nChanges As Long, lpSysColor As Long, lpColorValues As Long) As Long Declare PtrSafe Function DrawFocusRect Lib "user32" Alias "DrawFocusRect" (ByVal hdc As LongPtr, lpRect As RECT) As LongDeclare PtrSafe Function FillRect Lib "user32" Alias "FillRect" (ByVal hdc As LongPtr, lpRect As RECT, ByVal hBrush As LongPtr) As LongDeclare PtrSafe Function FrameRect Lib "user32" Alias "FrameRect" (ByVal hdc As LongPtr, lpRect As RECT, ByVal hBrush As LongPtr) As LongDeclare PtrSafe Function InvertRect Lib "user32" Alias "InvertRect" (ByVal hdc As LongPtr, lpRect As RECT) As LongDeclare PtrSafe Function SetRect Lib "user32" Alias "SetRect" (lpRect As RECT, ByVal X1 As Long, ByVal Y1 As Long, ByVal X2 As Long, ByVal Y2 As Long) As LongDeclare PtrSafe Function SetRectEmpty Lib "user32" Alias "SetRectEmpty" (lpRect As RECT) As LongDeclare PtrSafe Function CopyRect Lib "user32" Alias "CopyRect" (lpDestRect As RECT, lpSourceRect As RECT) As LongDeclare PtrSafe Function InflateRect Lib "user32" Alias "InflateRect" (lpRect As RECT, ByVal x As Long, ByVal y As Long) As LongDeclare PtrSafe Function IntersectRect Lib "user32" Alias "IntersectRect" (lpDestRect As RECT, lpSrc1Rect As RECT, lpSrc2Rect As RECT) As LongDeclare PtrSafe Function UnionRect Lib "user32" Alias "UnionRect" (lpDestRect As RECT, lpSrc1Rect As RECT, lpSrc2Rect As RECT) As LongDeclare PtrSafe Function SubtractRect Lib "user32" Alias "SubtractRect" (lprcDst As RECT, lprcSrc1 As RECT, lprcSrc2 As RECT) As LongDeclare PtrSafe Function OffsetRect Lib "user32" Alias "OffsetRect" (lpRect As RECT, ByVal x As Long, ByVal y As Long) As LongDeclare PtrSafe Function IsRectEmpty Lib "user32" Alias "IsRectEmpty" (lpRect As RECT) As LongDeclare PtrSafe Function EqualRect Lib "user32" Alias "EqualRect" (lpRect1 As RECT, lpRect2 As RECT) As LongDeclare PtrSafe Function PtInRect Lib "user32" Alias "PtInRect" (lpRect As RECT, pt As POINTAPI) As Long Declare PtrSafe Function GetWindowWord Lib "user32" Alias "GetWindowWord" (ByVal hwnd As LongPtr, ByVal nIndex As Long) As IntegerDeclare PtrSafe Function SetWindowWord Lib "user32" Alias "SetWindowWord" (ByVal hwnd As LongPtr, ByVal nIndex As Long, ByVal wNewWord As Long) As LongDeclare PtrSafe Function GetClassWord Lib "user32" Alias "GetClassWord" (ByVal hwnd As LongPtr, ByVal nIndex As Long) As LongDeclare PtrSafe Function SetClassWord Lib "user32" Alias "SetClassWord" (ByVal hwnd As LongPtr, ByVal nIndex As Long, ByVal wNewWord As Long) As LongDeclare PtrSafe Function GetDesktopWindow Lib "user32" Alias "GetDesktopWindow" () As LongPtr #If Win64 ThenDeclare PtrSafe Function GetWindowLongPtr Lib "user32" Alias "GetWindowLongPtrA" (ByVal hwnd As LongPtr, ByVal nIndex As Long) As LongPtrDeclare PtrSafe Function SetWindowLongPtr Lib "user32" Alias "SetWindowLongPtrA" (ByVal hwnd As LongPtr, ByVal nIndex As Long, ByVal dwNewLong As LongPtr) As LongPtrDeclare PtrSafe Function GetClassLongPtr Lib "user32" Alias "GetClassLongPtrA" (ByVal hwnd As LongPtr, ByVal nIndex As Long) As LongPtrDeclare PtrSafe Function SetClassLongPtr Lib "user32" Alias "SetClassLongPtrA" (ByVal hwnd As LongPtr, ByVal nIndex As Long, ByVal dwNewLong As LongPtr) As LongPtr#ElseDeclare PtrSafe Function GetWindowLongPtr Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As LongPtr, ByVal nIndex As Long) As LongPtrDeclare PtrSafe Function SetWindowLongPtr Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As LongPtr, ByVal nIndex As Long, ByVal dwNewLong As LongPtr) As LongPtrDeclare PtrSafe Function GetClassLongPtr Lib "user32" Alias "GetClassLongA" (ByVal hwnd As LongPtr, ByVal nIndex As Long) As LongPtrDeclare PtrSafe Function SetClassLongPtr Lib "user32" Alias "SetClassLongA" (ByVal hwnd As LongPtr, ByVal nIndex As Long, ByVal dwNewLong As LongPtr) As LongPtr ' Provided for reference only. Please use the LongPtr versions instead.Declare PtrSafe Function GetWindowLong Lib "user32" Alias "GetWindowLongA" (ByVal hwnd As LongPtr, ByVal nIndex As Long) As LongDeclare PtrSafe Function SetWindowLong Lib "user32" Alias "SetWindowLongA" (ByVal hwnd As LongPtr, ByVal nIndex As Long, ByVal dwNewLong As Long) As LongDeclare PtrSafe Function GetClassLong Lib "user32" Alias "GetClassLongA" (ByVal hwnd As LongPtr, ByVal nIndex As Long) As LongDeclare PtrSafe Function SetClassLong Lib "user32" Alias "SetClassLongA" (ByVal hwnd As LongPtr, ByVal nIndex As Long, ByVal dwNewLong As Long) As Long#End If第1套教程:VBA代码解决方案 第2套教程:VBA数据库解决方案第3套教程:VBA数组与字典解决方案第4套教程:VBA代码解决方案之视频(第一套的视频讲解)第5套教程:VBA中类的解读和利用第6套教程:VBA信息获取与处理第7套教程:VBA之EXCEL应用第8套教程:VBA之Word应用(最新推出)上述教程的学习顺序:① 7→1→3→2→6→5或者7→4→3→2→6→5。② 7→8