ExcelBanter

ExcelBanter (https://www.excelbanter.com/)
-   Excel Programming (https://www.excelbanter.com/excel-programming/)
-   -   Msgbox API (https://www.excelbanter.com/excel-programming/323901-msgbox-api.html)

RB Smissaert

Msgbox API
 
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 Staff

Msgbox API
 
Hi RB

A userform is better for this. See
http://www.dicks-blog.com/archives/2...message-boxes/

HTH. Best wishes Harald

"RB Smissaert" skrev i melding
...
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




RB Smissaert

Msgbox API
 
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


"Harald Staff" wrote in message
...
Hi RB

A userform is better for this. See
http://www.dicks-blog.com/archives/2...message-boxes/

HTH. Best wishes Harald

"RB Smissaert" skrev i melding
...
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 Staff

Msgbox API
 
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

"RB Smissaert" skrev i melding
...
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


"Harald Staff" wrote in message
...
Hi RB

A userform is better for this. See
http://www.dicks-blog.com/archives/2...message-boxes/

HTH. Best wishes Harald

"RB Smissaert" skrev i melding
...
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







RB Smissaert

Msgbox API
 
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

"Harald Staff" wrote in message
...
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

"RB Smissaert" skrev i melding
...
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


"Harald Staff" wrote in message
...
Hi RB

A userform is better for this. See
http://www.dicks-blog.com/archives/2...message-boxes/

HTH. Best wishes Harald

"RB Smissaert" skrev i melding
...
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 Staff

Msgbox API
 
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

"RB Smissaert" skrev i melding
...
Harald,


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.




RB Smissaert

Msgbox API
 
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


"Harald Staff" wrote in message
...
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

"RB Smissaert" skrev i melding
...
Harald,


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.






All times are GMT +1. The time now is 05:42 PM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com