Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 5
Default The Dialogs collection

Hi,

I think this may not be possible but I thought I would ask just in
case.

Can I get the results from a built in dialog box?

for example if I show the xlDialogActiveCellFont dialog box and then
the user selects which font, size etc they want, can I pass the
results to variables to be used at a later date? I have worked out
that I can evaluate the results after the user has changed the font by
using the following code:

Sub test()
Range("A1").Select
Application.Dialogs(xlDialogActiveCellFont).Show
font1 = Range("A1").Font.Name
End Sub

The problem is that I don't want the spreadsheet changed at all until
a later date. So before I go off and create my own user forms i
thought I would check to see if this is possible?

Cheers in advance.

James
  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 811
Default The Dialogs collection

Hi James,

The call: Application.Dialogs(xlDialogActiveCellFont).Show will return
True or False depending whether or not the user clicked the OK or Cancel
button. This is the extent of information you can derive from this method.
If the user clicks OK, whatever selection they made in the dialog will take
effect immediately.

If you want to delay the effect of the user's selection, thing get a bit
complicated. Assuming you know the cell(s) the user has selected prior to
invoking the method call above (which seems highly probable), you can store
all initial format conditions of those cells prior to showing the dialog.

If the method call returns True, meaning the user clicked OK, you will
need to store the resulting difference in the formats that the user selected
in the dialog by reading the state of those cells and then restore the
previous format. You can then commit the user's selected format whenever
you're ready, since you have this information stored.

For a single cell that doesn't contain anything unusual, multiple font
styles within the same cell for example, this is not too complicated. But
the level of complexity increases with the number of cells formatted as well
as the complexity of the formats. Hope that helps. Post back if there's
anything that isn't clear.

--
Rob Bovey, Excel MVP
Application Professionals
http://www.appspro.com/

* Take your Excel development skills to the next level.
* Professional Excel Development
http://www.appspro.com/Books/Books.htm

"James Butler" wrote in message
m...
Hi,

I think this may not be possible but I thought I would ask just in
case.

Can I get the results from a built in dialog box?

for example if I show the xlDialogActiveCellFont dialog box and then
the user selects which font, size etc they want, can I pass the
results to variables to be used at a later date? I have worked out
that I can evaluate the results after the user has changed the font by
using the following code:

Sub test()
Range("A1").Select
Application.Dialogs(xlDialogActiveCellFont).Show
font1 = Range("A1").Font.Name
End Sub

The problem is that I don't want the spreadsheet changed at all until
a later date. So before I go off and create my own user forms i
thought I would check to see if this is possible?

Cheers in advance.

James



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
Dialogs nc Excel Discussion (Misc queries) 1 March 23rd 05 02:17 PM
problems with dialogs François Excel Programming 5 February 21st 05 10:34 AM
How to disable the Application Dialogs Philip Excel Programming 1 November 5th 04 08:50 PM
Dialogs Command Stratuser Excel Programming 0 February 12th 04 03:43 PM
Using Dialogs Save Stratuser[_2_] Excel Programming 0 July 22nd 03 08:59 PM


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