Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Userform problem with "Run Time Error 75"


I think I found the problem. I set bIsLoaded = False in the function
below. Without this statement the function was returing nothing which
may of caused problems with your code.




Function IsFormLoaded(sFrmName As String) As Boolean
Dim i As Long
Dim bIsLoaded As Boolean
bIsLoaded = False

For i = 1 To UserForms.Count
If UserForms(i - 1).Name = sFrmName Then
bIsLoaded = True
Exit For
End If
Next
IsFormLoaded = bIsLoaded
End Function


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

Microsoft Office Help

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 309
Default Userform problem with "Run Time Error 75"

Hi Joel. Thanks for catching that minor function flaw.
Unfortunately, my workbook is still crashing with a Run Time
Error 75 because my Userform1 object seems to keep
vanishing.

I have stripped down my code to only the following which
is placed in my Userform1 code module.
-------------------------------------------------------------------------------
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
-------------------------------------------------------------------------------
' Module 1
Sub Button1_Click()
Userform1.Show vbModeless
End Sub
------------------------------------------------------------------------------

The problem seems to be the "SetWindowLongA" function call which changes the
window style to GWL_PARENT.

I know that if I get rid of this call to SetWindowLongA that my Userform1
will
never disappear at random times, but I really love having this special popup
window
that remains visible even when Excel is minimized.

Also, the above code works fine on my Windows Vista machine. It only
crashes
on Windows XP, Service Pack 2. Try loading the userform a couple times,
walk away from your computer for about 2-5 minutes after the screen saver
turns
on, then try to load the userform again. That is when I get the message
"Could not find the specified object"

How about if I set the Userform flag back to it's original setting when the
user
closes out or unloads the form??? In other words, how can I change the
window flag from GWL_HWNDPARENT back to it's original setting???
I'm not sure how I would do that??



"joel" wrote in message
...

I think I found the problem. I set bIsLoaded = False in the function
below. Without this statement the function was returing nothing which
may of caused problems with your code.


  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1
Default Userform problem with "Run Time Error 75"


I'm using XP SP3 (not 2) with Office 2003 and not having the problem.
My Monitor is set to 800 x 600.

I verified my SP3 by going to control panel and selecting Add/Remove
Programs. At the end of the list of installed software is Windows XP
Service Pack 3.


I also chaeck the version of windows by getting a DOS window (cms.exe).
the top of the DOS window show 5.1.2600. I upgrade a couple weeks ago
manually so the exact numbers may not match.


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

Microsoft Office Help

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
Help with userform problem: error message "obj doesn't support thisproperty or method" Chet Excel Programming 4 August 13th 09 09:00 PM
Userform problem with "obj doesn't support this property or method"error message. Chet Excel Programming 0 August 12th 09 05:26 PM
how do I correct a "run time error 1004-unable to open" problem? BillR Excel Programming 1 August 26th 08 07:21 PM
Problem with "On error resume next" with "custom VLookup" Factivator Excel Programming 3 July 20th 04 04:42 PM
"Can't Show Modally" - Run-Time Error '400' Problem Bruce B[_2_] Excel Programming 3 July 14th 03 02:01 PM


All times are GMT +1. The time now is 01:31 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"