If your doing this in a form then change the declaration of the variable
hWnd.
e.g.
Dim lnghWnd As Long
Dim lpClassName As String
Dim lpWindowName As String
lpClassName = "#32770"
lnghWnd = FindWindow(lpClassName, lpWindowName)
Call PostMessage( _
lnghWnd, _
WM_CLOSE, _
0, _
ByVal 0&)
You are getting this erro because hWnd is a property of the form, changing
the name of the variable will sort that out.
Yes lpWindowName should be an empty string for this purpose. we could have
done this
Dim lnghWnd As Long
Dim lpClassName As String
lpClassName = "#32770"
lnghWnd = FindWindow(lpClassName, "")
.... but as I was just knocking out the code I didn't bother too musch with
cleaning up.
I would have thought though as you already have a routing t oidentify the
dialog you would have it's hWnd (by this I mean the handle to the window),
you kust need to substitute that value for the lnghWnd variable above.
--
Terry Kreft
"Hank" <ha********@aol.com> wrote in message
news:11*********************@g43g2000cwa.googlegro ups.com...
I put Terry's two functions in the Declaration section of my Main Menu
and made the call below from the Timer Event.
When I execute this line:
hWnd = FindWindow(lpClassName, lpWindowName)
I get an error message:
"To set this property open the report or form in design view"
I notice we are not initializing lpWindowName - Is that correct
Hank Reed