From: Robert Crandal on
This is follow-up related to my posting here on 12/19/09
regarding "Run Time Error 75" ("Could Not Find The
Specified Object".

Basically, my Userform1 is "disappearing" from my workbook
for some unknown reason, even if my workbook is untouched
for any period of time longer than 2 minutes. If I come back to
my computer after 2 minutes, I will try to load my form with this
code: (which causes RT-Error 75)

UserForm1.Show vbModeless

I also get an Error 75 message if I try to run the following code:

MsgBox "Name of form: " & UserForm1.Name

Then, if I try to view my UserForm1 object in my VBAProject
view window, I get an error that says "Path/File sccess Error".

Does anybody have any theories why I cannot suddenly use
Userform1 in my workbook, especially if my code is not very
complicated at all?? All I do is handle UserForm1_Initialize()
and Worksheet_Change() and all my code does is transfer
data from userform to spreadsheet and vice versa with very
very very basic VBA code. I even set "Application.EnableEvents"
to false and true inside my Worksheet_change() function.

Could this be just an operating system issues?? (I noticed
that this problem only occurs while using Excel 2007
(Trial Version) on Windows XP Professional SP2. I never get
this error on Windows Vista using Excel 2007)

Might this problem just be related to a bad or bugged version
of Windows XP, Service Pack 2??? I can't think of anything else.

thank you!


From: joel on

check the Error trapping setting with Vista and XP in the VBA menu


Tools - Options - General - Error Trapping.

I usually operate with Stop On All Errors because I usually find
skipping one error in the code usually creates another error futher in
the code. If I fix the first error the second error also gets fixed.

also temperarily comment out all ON ERROR statements. Sometimes you
error trapping isn't working properly and produces a 2nd error. It is
best to try to correct all errors and not skip through errors.


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

[url="http://www.thecodecage.com"]Microsoft Office Help[/url]

From: Robert Crandal on
Both Vista and XP were set to "Break on Unhandled Errors". I tried
setting Windows XP SP2 to "Break On All Errors", but I didn't notice
anything different. My userform1 still "cannot be found".

My code really is very very simple and basic. It just has a button
on Sheet1 which calls "Userform1.Show vbModeless". It works fine
after 2 minutes or so, but if I come back to the computer and press
the button to call "Userform1.Show vbModeless", that is when I
get the above stated error messages/codes.

My Worksheet_Change() function for Sheet1 looks like this:

Private Sub Worksheet_Change (ByVal Target As Range)
If MyUserformIsLoaded("UserForm1") Then
Application.EnableEvents = False
Userform1.Caption = Sheet1.Range("A1").Value
Application.EnableEvents = True
End If
End Sub

Also, my workbook only crashes on Windows XP SP2. Since my
code is very basic and simple and it runs great on Windows Vista,
I'm inclined to believe that something is wrong with my Windows XP
machine, but I'm not positive. I just wanted to get everybody's feedback
here to see if anyone has run into this problem before.


"joel" <joel.43xyv8(a)thecodecage.com> wrote in message
news:joel.43xyv8(a)thecodecage.com...
>
> check the Error trapping setting with Vista and XP in the VBA menu
>
>
> Tools - Options - General - Error Trapping.
>
> I usually operate with Stop On All Errors because I usually find
> skipping one error in the code usually creates another error futher in
> the code. If I fix the first error the second error also gets fixed.
>
> also temperarily comment out all ON ERROR statements. Sometimes you
> error trapping isn't working properly and produces a 2nd error. It is
> best to try to correct all errors and not skip through errors.
>

From: joel on

Can you provide the function "MyUserformIsLoaded" and let me know where
the code is located?


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

[url=&quot;http://www.thecodecage.com&quot;]Microsoft Office Help[/url]

From: Robert Crandal on
Sure.... I'm using code that was provided by "Peter T" from this
newsgroup. Here it is:

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


I simply renamed the function to "MyUserformIsLoaded" wherever
needed!


"joel" <joel.43yf2z(a)thecodecage.com> wrote in message
news:joel.43yf2z(a)thecodecage.com...
>
> Can you provide the function "MyUserformIsLoaded" and let me know where
> the code is located?
>
>
> --
> joel
> ------------------------------------------------------------------------
> joel's Profile: 229
> View this thread:
> http://www.thecodecage.com/forumz/showthread.php?t=165579
>
> [url=&quot;http://www.thecodecage.com&quot;]Microsoft Office Help[/url]
>