PC Review


Reply
Thread Tools Rate Thread

"Coult not find specified object" and "Path-File access error" messages

 
 
Robert Crandal
Guest
Posts: n/a
 
      19th Dec 2009
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


 
Reply With Quote
 
 
 
 
Rick Rothstein
Guest
Posts: n/a
 
      19th Dec 2009
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" <(E-Mail Removed)> wrote in message
news:dw0Xm.99264$(E-Mail Removed)...
>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
>
>


 
Reply With Quote
 
Robert Crandal
Guest
Posts: n/a
 
      19th Dec 2009
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
>
> 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" <(E-Mail Removed)> wrote in message
> news:dw0Xm.99264$(E-Mail Removed)...
>>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


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to properly "call" a macro - getting error 2485 "can't find object" EagleOne@microsoftdiscussiongroups.com Microsoft Access 2 24th May 2008 06:08 PM
Getting "delayed write failed" and "path too deep" error messages =?Utf-8?B?Um90b3JoZWFkODc=?= Windows XP Hardware 5 20th Apr 2006 05:06 PM
<forms name="CompanyWeb" loginUrl="login.aspx" protection="All" path="/" /> Murphy Microsoft ASP .NET 2 19th Apr 2004 08:01 AM
Error messages: "Winsck," "Status," and "Unable to open dialog" =?Utf-8?B?Sm9u?= Microsoft Windows 2000 0 9th Nov 2003 06:16 AM
Error messages: "Winsck," "Status," and "Unable to open dialog" =?Utf-8?B?Sm9u?= Microsoft Windows 2000 0 28th Oct 2003 12:51 AM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 06:09 AM.