Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 430
Default Close Dialog Box with SendKeys

at the end of my code using a bunch of SendKeys commands
I'm trying to close a dialog box using:

SendKeys "{Enter}"

and it's not working; any ideas?

TIA,,


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default Close Dialog Box with SendKeys

Jim,

any window can be closed with AltF4.. (unless closebox is disabled)

Application.SendKeys "%{F4}"
Application.Dialogs(xlDialogActiveCellFont).Show


keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


"Jim May" wrote:

at the end of my code using a bunch of SendKeys commands
I'm trying to close a dialog box using:

SendKeys "{Enter}"

and it's not working; any ideas?

TIA,,




  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 430
Default Close Dialog Box with SendKeys

It's still not working;
What does line two do?
Line 2: Application.Dialogs(xlDialogActiveCellFont).Show

Here is code at last attempt:

Sub ToggleSavePreviewPicture()
' Sends ALT+F to open the File menu.
SendKeys ("%f"), True
' Sends ALT+I to open the Properties dialog box and displays the
' Summary tab.
SendKeys ("i"), False
' Selects the Save Preview Picture check box.
SendKeys ("%v"), True
' Close Dialog Box
SendKeys ("%{F4}")
End Sub

Jim May

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!
  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,253
Default Close Dialog Box with SendKeys

the 2nd line was an example of how to use sendkeys
with a "dummy" dialog.

(normally you use sendkeys BEFORE opening the dialog..
Jim,

I can see what you want to do..
BUT I dont know an alternative approach to setting that value.
AND SENDKEYS is doomed to fail...

Just open that dialog yourself.
Select the 3rd tab.
Close the dialog.

Open the Dialog again..

See?... It's still on the 3rd tab.. but there's no way (without api's) to
tell which Tab is active. and the Tabs themselves have no accelerator...

Also IF the checkbox was already checked, your code will uncheck it..

FAIK the only alternative is complex code with API's to trap the dialog,
read the settings of the SysTabControl32 object.. etc etc.





keepITcool

< email : keepitcool chello nl (with @ and .)
< homepage: http://members.chello.nl/keepitcool


Jim May wrote:

It's still not working;
What does line two do?
Line 2: Application.Dialogs(xlDialogActiveCellFont).Show

Here is code at last attempt:

Sub ToggleSavePreviewPicture()
' Sends ALT+F to open the File menu.
SendKeys ("%f"), True
' Sends ALT+I to open the Properties dialog box and displays the
' Summary tab.
SendKeys ("i"), False
' Selects the Save Preview Picture check box.
SendKeys ("%v"), True
' Close Dialog Box
SendKeys ("%{F4}")
End Sub

Jim May

*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!


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
Save As dialog box keeps popping up and won't close John Excel Discussion (Misc queries) 2 June 18th 07 12:29 PM
Automatically Close Dialog Boxes chriskane Excel Worksheet Functions 2 August 9th 05 12:14 PM
Excel shoud not close all active books when clicking close button technomike Excel Discussion (Misc queries) 0 June 10th 05 05:35 PM
Close dialog box Web_Builder Excel Programming 3 August 6th 04 06:45 PM
Close file without Save Changes dialog box flumpf Excel Programming 1 October 24th 03 02:38 AM


All times are GMT +1. The time now is 02:58 AM.

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"