View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Robert Crandal Robert Crandal is offline
external usenet poster
 
Posts: 309
Default "Coult not find specified object" and "Path-File access error" messages

The API functions, specifically "SetWindowLong", are used to set some
special properties for the userform window. It creates a type of popup
userform that stays kind of detached from Excel and remains visible even
when
Excel is minimized. I was really hoping to use this style of popup, but
it's
causing those weird errors. 8(

Robert


"Rick Rothstein" wrote in message
...

Are you using the API code simply to show your UserForm as modeless (in
other words, so you can use the worksheet while the UserForm is
displayed)? If so, you don't need to use the API function calls at all...
just use this statement to show your UserForm...

UserForm1.Show vbModeless

Obviously, change the name of the UserForm from my example UserForm1 to
whatever the name of your UserForm actually is.

--
Rick (MVP - Excel)


"Robert Crandal" wrote in message
...
I am starting to see "Run Time Error 75 - Could not find
specified object" and I believe it is related to the modeless Userform
that I am using. Here are my modeless userform definitions:
-------------------------------------------------------------------------------
Private Declare Function FindWindow Lib "user32" Alias "FindWindowA" ( _
ByVal lpClassName As String, ByVal lpWindowName As String) As Long
Private Declare Function SetWindowLongA Lib "user32" _
(ByVal hWnd As Long, _
ByVal nIndex As Long, _
ByVal dwNewLong As Long) As Long

Private Const GWL_HWNDPARENT As Long = -8
------------------------------------------------------------------------------
Private Sub UserForm_Initialize()

Dim hWnd As Long

hWnd = FindWindow("ThunderDFrame", Me.Caption)
SetWindowLongA hWnd, GWL_HWNDPARENT, 0&

End Sub