|
-
Jan 1st, 2006, 04:39 PM
#1
Thread Starter
Member
change the Color of XL Formula Bar
Hi all,
I am trying to change the Excel formula bar color to red and I am using the following code but unfortunately doesn't work:
Code :
'\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
Private Type RECT
Left As Long
Top As Long
Right As Long
Bottom As Long
End Type
Declare Function GetWindowRect Lib "user32" (ByVal hwnd As Long, lpRect As RECT) As Long
Declare Function FillRect Lib "user32" _
(ByVal hdc As Long, lpRect As RECT, ByVal hBrush As Long) As Long
Declare Function FindWindowEx Lib "user32" Alias "FindWindowExA" _
(ByVal hWnd1 As Long, ByVal hWnd2 As Long, ByVal lpsz1 As String, ByVal _
lpsz2 As String) As Long
Declare Function GetDC Lib "user32" (ByVal hwnd As Long) As Long
Declare Function ReleaseDC Lib "user32" _
(ByVal hwnd As Long, ByVal hdc As Long) As Long
Sub ChangeFormulaBarColor()
Dim recto As RECT
Dim lngFrmBarHndle As Long
Dim lngFrmBarDC As Long
' Get the XL formula Bar window handle
lngFrmBarHndle = FindWindowEx(Application.hwnd, 0, "EXCEL<", vbNullString)
' Get its rectangle metrics
GetWindowRect lngFrmBarHndle, recto
' Get its window DC
lngFrmBarDC = GetDC(lngFrmBarHndle)
' Fill the Formula with Red Color
FillRect lngFrmBarDC, recto, &HFFFFFF + 1
' Release DC
ReleaseDC lngFrmBarHndle, lngFrmBarDC
End Sub
'\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\
Am I using the FillRect Function incorrectly ?
Regards.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|