R
Robert Crandal
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
-------------------------------------------------------------------------------
The above code allows me to create a nice modeless popup. I have not
experienced any problems with this popup until tonight. I displayed the
popup a couple times for test purposes, then I left my computer for about
5 minutes. When I came back, I tried to display the popup form again and
that is when the above error displayed on my screen.
Why would the form display properly, then 5 minutes later it displays an
error??
All I did was press a button on my spreadsheet that loads the form using
"Userform1.Show vbModeless", and then it crashed....
Even more odd, when I tried to view my form object in my VBA project window,
it gave me the following message: "Path/File access error".
Has anybody ever experienced this behavior and resolved it???
thank you
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
-------------------------------------------------------------------------------
The above code allows me to create a nice modeless popup. I have not
experienced any problems with this popup until tonight. I displayed the
popup a couple times for test purposes, then I left my computer for about
5 minutes. When I came back, I tried to display the popup form again and
that is when the above error displayed on my screen.
Why would the form display properly, then 5 minutes later it displays an
error??
All I did was press a button on my spreadsheet that loads the form using
"Userform1.Show vbModeless", and then it crashed....
Even more odd, when I tried to view my form object in my VBA project window,
it gave me the following message: "Path/File access error".
Has anybody ever experienced this behavior and resolved it???
thank you