Thread: Msgbox API
View Single Post
  #4   Report Post  
Posted to microsoft.public.excel.programming
Harald Staff Harald Staff is offline
external usenet poster
 
Posts: 292
Default 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