Msgbox API

  • Thread starter Thread starter RB Smissaert
  • Start date Start date
R

RB Smissaert

Found some useful code to customize the msgbox buttons:
http://www.xcelfiles.com
The problem is that the msgbox is getting too wide with the buttons way too
far to the right.
Would there be any solution for this or is it better just to forget about
this and use userforms?

RBS
 
Harald,

Thanks for the tip.
I had a look at the website, but there has to be a lot more code in the
userform
to adapt it to all the possible parameters such as the amount of text in the
message
and the button captions. Also you may need more buttons or less.
I would be interested if somebody had worked this all out.

RBS
 
Hi RB

There are literally thousands of variables here, including different length
of statements for different languages. Ans at most points it will look
pretty ugly.

But you can autosize buttons pretty easy by having a label on the userform
with the same font, fill it with text and autosize it:

Sub SetBtn1(Txt As String)
With Me.Lbl1
.Visible = False
.AutoSize = False
.Width = 300
.Caption = Txt
.AutoSize = True
End With
DoEvents
With Me.Btn1
.Width = Me.Lbl1.Width + 16
.Caption = Txt
End With
End Sub

HTH. Best wishes Harald
 
Harald,

Will try that.
Is there really no way then with API to customize the text on the buttons
without messing
up the whole layout of the messagebox? This is all I need.

RBS
 
Variable text length / button count / button width is a bad looking mess
already, no matter which platform you play it on. Maybe it's A way
somewhere, but it will not be a better way than a userform. All you need is
love.

HTH. Best wishes Harald
 
OK, will give up on that path.
Maybe I could make a function with all the needed arguments that creates the
right userform, shows it and returns the button pressed.
I want to avoid adding another userform to the project as it is getting
close to
the limits.

RBS
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top