Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 309
Default "Coult not find specified object" and "Path-File access error" messages

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


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default "Coult not find specified object" and "Path-File access error" messages


A window can have more than one pane such as with an IE explorer windows
can have more than one tab. The window name will change as you activate
each tab. Application can also have activeX controls that will change
the active window such ad AdWare. I don't know what is cuasing the
problem but I would see if the window Name that you are trying to access
changes and that is the cause of the problem.

You may want to check all processes instead of windows. The window
would be the parent of the process.

I wouold be nice if Microsoft allowed the Task manager to view the
Process ID and the Parent Process ID. You can view the Process ID but
not the parenet so you can track these type problems. Unix/Linix
operating system does show both. In window you can get the parents and
chid process but you have to write your own code. I think I've seen
utilites that will do this but it has been a number of years since I had
to write code that required this.


--
joel
------------------------------------------------------------------------
joel's Profile: 229
View this thread: http://www.thecodecage.com/forumz/sh...d.php?t=163906

Microsoft Office Help

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,934
Default "Coult not find specified object" and "Path-File access error" messages

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
-------------------------------------------------------------------------------

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



  #4   Report Post  
Posted to microsoft.public.excel.programming
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


Reply
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules

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


Similar Threads
Thread Thread Starter Forum Replies Last Post
Error Help - Method "Range" of object "_Worksheet" failed. Alan Smith Excel Programming 3 March 15th 07 06:55 PM
HELP on "left","right","find","len","substitute" functions serene83 Excel Discussion (Misc queries) 5 June 27th 06 02:23 AM
What is Error "Method "Paste" of object "_Worksheet" failed? vat Excel Programming 7 February 17th 06 08:05 PM
"Path/File Access Error" on Sheets.Copy Nick Cranham Excel Programming 4 April 15th 04 01:41 PM


All times are GMT +1. The time now is 09:57 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"