View Single Post
  #2   Report Post  
Posted to microsoft.public.excel.programming
Vasant Nanavati Vasant Nanavati is offline
external usenet poster
 
Posts: 1,080
Default Getting hWnd for API call or Color choosing dialog

Private Declare Function FindWindow Lib _
"user32" Alias "FindWindowA" _
(ByVal lpClassName As String, ByVal lpWindowName _
As String) As Long

Dim hWnd As Long
hWnd = FindWindow("XLMAIN", Application.Caption)

However, since Excel can only handle the 56 colors that are in the palette
associated with each workbook, I'm not sure how useful the ChooseColor
function will be.

--

Vasant

"Jeff" wrote in message
...
Hi All


I am using an API function and have to pass the Excel window handle. I

have,
in vain, tried to figure this out. How do you get the window handle. I

tried
xlGetHwnd which seemed to work but now it doesn't, which is really

strange?

The API function is ChooseColor. This is so I can display a dialog for
choosing a color. If anybody knows another way of displaying a colour
choosing dialog this would also be good.

Jeff