Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 91
Default Nasty intermittent


VB code:

Dim frm As UserForm
For Each frm In UserForms
If frm Is frmLabel Then
If frmLabel.Visible Then Unload frmLabel
End If
Next


This works just fine 99% of the time. But ocassionally errror

frmlabel = <Object variable or With block variable not set

appears and the line highlighted is

If frm Is frmLabel Then

It's Ok on the next run though.

Anyone know what this might be?

Thanks - Kirk
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 50
Default Nasty intermittent

VBA has tiny stack for nested operators
try to complete condition with END IF to avoid recurcive stack
allocation.
  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5,600
Default Nasty intermittent

this line -
If frm Is frmLabel Then
will Load frmLabel if it was not already loaded

If(?) the objective is to unload frmLabel if loaded (but not accidentally
load it merely by testing for it)

For I = UserForms.Count To 1 Step -1
If UserForms(i - 1).Name = "frmLabel" Then
Unload UserForms (i - 1)
' or
' Unload frmLabel
Exit For ' not necessary but might as well
End If
Next

Regards,
Peter T



"kirkm" wrote in message
...

VB code:

Dim frm As UserForm
For Each frm In UserForms
If frm Is frmLabel Then
If frmLabel.Visible Then Unload frmLabel
End If
Next


This works just fine 99% of the time. But ocassionally errror

frmlabel = <Object variable or With block variable not set

appears and the line highlighted is

If frm Is frmLabel Then

It's Ok on the next run though.

Anyone know what this might be?

Thanks - Kirk



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
VBA WMI Intermittent Error [email protected] Excel Programming 0 September 7th 07 01:32 PM
Intermittent Links Kenji Links and Linking in Excel 0 January 2nd 07 05:39 PM
Nasty IF Statement bodhisatvaofboogie Excel Programming 3 July 21st 06 01:31 PM
nasty little excel autofilling ****** [email protected] Excel Discussion (Misc queries) 1 July 13th 06 12:05 AM
Intermittent issue PeterG Excel Discussion (Misc queries) 1 May 26th 05 04:01 PM


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