dialogsheets

sykes

Well-known Member
Joined
May 1, 2002
Messages
1,883
Office Version
  1. 365
Platform
  1. Windows
Hi Chaps & chapesses

I'm working on a project with which I'm using several dialog sheets for user input etc etc.
After the first one is shown, the user makes a selection, which in turn brings up a message box with VByesno, and some text.
The user then selects y or n, and another dialog sheets pops up for them to enter some more data / make some more selections.
I notice that each time a new messagebox or dialog sheet comes up, the previous ones are still visible in the background. This isn't really a problem, apart from the fact that I can't get rid of them or close them down, when I want to, which tends to indicate that I'm not achieving everything I wish to in learning about Vba.
Eventually they do disappear when the last macro runs, which just activates a worksheet with all the results on, ready for the user to print.

I've tried using the object browser to determine the correct code, but to no avail.

to open them up, I'm just using :

dialogsheets("blah").show

which is fine, but to close them, I've tried visible = false, hide , show = false ,go away, why don't you just **** off?, but as I said, to no avail.

Ta, in advance

....and please keep up the good work on such a great site.

Sykes
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"

ttmac

New Member
Joined
Aug 27, 2002
Messages
8
Place the line

me.hide

immediately before the line that calls the next dialog box, i.e.

dialogsheets("blah").show

Tom
 

sykes

Well-known Member
Joined
May 1, 2002
Messages
1,883
Office Version
  1. 365
Platform
  1. Windows
Thanks Tom.

Unfortunately it failed.
Help says you can only use ME in class modules, and not in a standard module, which is what I'm using at the moment.
I havn't fully investigated different types of module yet though, so it may be a good lead........

Sykes
 

Andrew Poulsom

MrExcel MVP
Joined
Jul 21, 2002
Messages
73,092
Working with the old Dialog Sheets can be tricky when one calls another. Try using a loop like this:

Code:
Sub ShowDlg()
    Dim DlgOK as Boolean
    DlgOK = True
    Do Until DlgOK = False
        DlgOK = DialogSheets("YourDialog").Show
        If DlgOK = False Then Exit Sub
        '*** Your code to display the next Dialog box goes here ***
    Loop
End Sub

This assumes your dialog box has OK and Cancel buttons and that the OK button has the Dismiss property checked. It will be dismissed when the user clicks one.
[SIZE=2][COLOR=gray]This message was edited by  Andrew Poulsom on 2002-09-03 01:52 [/COLOR][/SIZE]
 

ttmac

New Member
Joined
Aug 27, 2002
Messages
8

ADVERTISEMENT

Sykes,

Using Excel 2000 I am able to use the ME keyword.

Create two new userforms - userform1 and userform 2, place a command button on userform1 and place the following code in the click event

Private Sub CommandButton1_Click()
Me.Hide
UserForm2.Show
End Sub

Try it... it works for me

Tom
 

sykes

Well-known Member
Joined
May 1, 2002
Messages
1,883
Office Version
  1. 365
Platform
  1. Windows
Thanks for the reply chaps.

I'll be trying both ideas later, and will report back.

Tom, I've got a notion that whilst ME will work for userforms, it won't for dialogsheets, but I'm ready to eat my words, as always!

Regards both of you.

Sykes
 

msvec

Board Regular
Joined
Feb 18, 2002
Messages
202
along these lines, i have a button that allows the user to insert a pic to a tab and then i copy the pic to the dialog sheet, but i can't get the dialog sheet to repaint. so, i've tried settting a flat somewhere that upon closing the dialog, the userform that gets activated checks the flag and would then recall the dialog sheet, but it says the sheet is then out of range. how can i simply close and reshow the dialog box.

all of this, by the way, is due to the fact that you cannot loadpicture() from a pic embedded in a worksheet...anywho, any help would be dandy now that i've gone down this road.

thx
 

Forum statistics

Threads
1,143,640
Messages
5,719,985
Members
422,256
Latest member
downeybm

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Top