W2000 - change initial focus of the file insert dialog box 
Author Message
 W2000 - change initial focus of the file insert dialog box

With a routine I'm automatically opening the file insert dialog box.
However the initial focus is standard on the 'file name' text box.
How can make my routine so that when the file insert dialog box is opened
the focus is not on the standard text box anymore but on the window that
lists all the file names so that I don't have to click or tab to the file
window.

Thanks,
John



Sat, 03 Jul 2004 06:26:41 GMT  
 W2000 - change initial focus of the file insert dialog box
John,

I assume you're using this to open the box:

   Dialogs(wdDialogInsertFile).Show

If so, what you probably need is the inelegant-but-useful SendKeys
statement, to feed two Shift+Tab's into the dialog.  You'd think this
would work:

   SendKeys "+{tab 2}"
   Dialogs(wdDialogInsertFile).Show

But it doesn't.  VBA is too quick to receive the keystrokes.  Instead,
separate these into two macros and have one call the other with a tiny
delay:

   Sub InsertFileCustom1
   Application.OnTime When:=Now + TimeValue("00:00:01"), _
      Name:="InsertFileCustom2"
   End Sub

   Sub InsertFileCustom2
   DoEvents
   SendKeys "+{tab 2}"
   Dialogs(wdDialogInsertFile).Show
   End Sub

In future when asking questions about your code, please post the relevant
section of it so we know what to tell you.  (Don't shovel the whole macro
into a post; distill it to the part you know has a problem.)


-- See the MVP FAQ at http://www.mvps.org/word --------------------------
----------------- "Life is nothing if you're not obsessed." --John Waters
-------------------------------------------------------------------------
Please reply only to the newsgroup.  Note: MVPs do not work for Microsoft.

Quote:

> With a routine I'm automatically opening the file insert dialog box.
> However the initial focus is standard on the 'file name' text box.
> How can make my routine so that when the file insert dialog box is opened
> the focus is not on the standard text box anymore but on the window that
> lists all the file names so that I don't have to click or tab to the file
> window.

> Thanks,
> John



Sat, 03 Jul 2004 07:00:34 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. Changing the initial dialog box...

2. Restrict Windows File Dialog to Initial Folder?

3. Change File Name in FileSaveAs dialog box

4. Changing Focus to Print Dialog

5. Unexpected Focus Change/Dialog Background Color

6. vb4.0 32-bit common dialog box causes focus to be lost

7. losing focus of a dialog box

8. Inserting data into bookmarks W2000

9. Inserting data into bookmarks W2000

10. Insert Hyperlink Dialog Box Code

11. Dialog box displayed during query insert or query update

12. Displaying 2nd tab of Insert Object dialog box

 

 
Powered by phpBB® Forum Software