LinkBack Thread Tools Search this Thread Display Modes
Prev Previous Post   Next Post Next
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 13
Default AppActivate problems or is there a better way to take focus froma non modal user form

I have a workbook that displays a non modal user form when the workbook is
opened. The user form contains a bunch of buttons for running a number of
different macros. After one of the macros runs I want to move focus from the
user form back to the worksheet. I have been using the following statement to
do this:

AppActivate ActiveWorkbook.Windows(1).Caption

This works much of the time but occasionally it fails with an invalid argument
error message. I have no idea what causes the statement to stop working or
begin working again shortly after it has been failing. When the problem is
occurring stopping and restarting Excel does not fix the problem. The problem
occurs when the workbook is the only one open in Excel. I also know that the
value of the caption field is correct from looking at it while in debug.
Sometimes just waiting a few minutes makes the problem go away.

Two questions:

1. Anyone have an idea as to what would cause the appactivate statement to start
failing or working again?

2. Is there a better way to move focus from a non modal user form back to the
worksheet?

Thanks for your help,

Mike Clemens
 
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
set focus on user form jhahes[_2_] Excel Programming 1 June 1st 05 09:26 PM
User Form focus Glen Mettler[_2_] Excel Programming 3 October 10th 04 05:31 PM
Modeless User Form and Worksheet Focus JWolf Excel Programming 2 May 26th 04 08:27 PM
Modal User Form Jim M[_3_] Excel Programming 1 November 4th 03 10:38 PM
Text Box on User Form Set Focus Issue John Flynn Excel Programming 0 September 6th 03 02:41 PM


All times are GMT +1. The time now is 10:04 PM.

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

About Us

"It's about Microsoft Excel"