Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Form does not disappear

Project has two forms: formMain and formHelp.

formMain has two buttons:
"Help" button with code formHelp.Show
"Hide" button with code Me.Hide

formHelp has a "Close" button with code Unload Me

When formMain first shows I can move it around with no trail in the
background.

Two problems occur when formHelp shows:
When I move it around, it leaves a trail.

When I press formHelp's Close button, formMain appears but formHelp
(larger than formMain) still shows in the background. When I now move
formMain around, it also leaves a trail.

The same problems occur if I close formHelp with the red X close.
I get the impression something is wrong with formHelp.

If I click formMain's Hide button, both forms and their trails
disappear.

An earlier version does not have this problem; I don't know what caused
the change.

I've tried these ideas from another post:
(1) move code from form module to code module.
(2) insert Application.ScreenUpdating toggle.

Sub HelpShow()
formHelp.Show
Application.ScreenUpdating = False
Application.ScreenUpdating = True
End Sub

Sub HelpClose()
Unload formHelp
Application.ScreenUpdating = False
Application.ScreenUpdating = True
End Sub

These did not resolve the problem.

I have XP and Excel 2000.

Thanks,
George

  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 133
Default Form does not disappear

when you call formHelp.Show

Make it Modeless (i.e. can be moved)

Try this:


formHelp.Show vbModeless
instead of formHelp.Show

  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 7
Default Form does not disappear

Chip,
The primary goal was not to move the Help form. I described the two
symptoms as unusual behavior only to indicate a problem.
I've done some testing (showing more interesting odd things) and found
a resolution.

Background on what I'm trying to do:
Help sheet has information that goes into Help form ListBoxes.
Top LB has subject names. When user clicks on a subject, lower LB
displays the details for that subject.
Help sheet is "xlVeryHidden" away from user.

In Help form Activate sub in Help form module, code activates sheet
Help, calls a sub that has a WorksheetFunction to get the last row of
the active sheet, then copies info from the Help sheet to the top LB.

I set a Breakpoint at top of this Activate sub. I get different results
if I F5 at that point or if I F8 through it.
F5 results:
Data from sheet Help is copied into the LB. When I move the form it
leaves a trail in the background. If the Excel window is maximized, the
Help form does not disappear when it's closed.

F8 results:
Even though Help sheet is activated, sName = activesheet.name shows the
only visible sheet. The WorksheetFunction provides info for that
visible sheet and data is not copied into the LB. When the Help form
closes, it disappears.

Question#1. Why does code act differently depending on F5 or F8?
Question#2. In F8, if Help sheet.activate does not work, why isn't
there an error message?

If Help sheet is made visible, both F5 and F8 provide the same expected
good results; the two initial problems - form leaving a trail and Help
not disappearing - do not occur.

Therefore the problems were apparently caused by code working with a
hidden sheet that was activated.

But I don't want to have sheet Help visible.

Here is how I resolved the problem:
In the Activate sub, removed Help sheet.activate, which didn't work in
F8 mode.
Modified code to work with a specific range in Sheet Help.
Modified the WorksheetFunction to deal with a specific range (workbook
name and sheet name are arguments) instead of assuming the active
sheet.
With sheet Help 'xlVeryHidden', results are OK in either F5 or F8 mode.

George

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
Menu Bar disappear Lucy Excel Discussion (Misc queries) 1 September 19th 08 07:52 PM
why workbook disappear ? fathy Excel Worksheet Functions 1 March 21st 07 05:52 PM
Tabstrip tabs entered programmatically disappear after form unload cumchee Excel Programming 1 January 21st 05 08:04 PM
Add-Ins disappear Gates72 Setting up and Configuration of Excel 0 December 2nd 04 04:06 PM
Form Doesn't Disappear Stratuser Excel Programming 2 October 13th 04 10:39 PM


All times are GMT +1. The time now is 07:00 AM.

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"