Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1   Report Post  
Posted to microsoft.public.excel.programming
MD MD is offline
external usenet poster
 
Posts: 9
Default resize my userform

Good day all,

Is there a way to make a userform with a Listbox resizeable by the user?

TIA
MD


  #2   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 94
Default resize my userform

No, there is no way in Excel VBA.

Regards,
Edwin Tam

http://www.vonixx.com


"MD" wrote:

Good day all,

Is there a way to make a userform with a Listbox resizeable by the user?

TIA
MD



  #3   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,298
Default resize my userform

is it the userform that you want to resize, or the listbox?
new form
5 buttons (btnNarrow,btnWider,btnShorter,btnLonger)
2 text boxes(txtHeight,txtWidth)
1 listbox(listbox1)
set the listbox so that it runs down the left of the form
put the buttons in a column

add this code:
Option Explicit
Private Sub UserForm_Initialize()
SetTextBoxes
End Sub
Private Sub btnLonger_Click()
txtHeight = Me.Height * 1.1
btnResize_Click
End Sub
Private Sub btnNarrow_Click()
txtWidth = Me.Width * 0.9
btnResize_Click
End Sub
Private Sub btnShorter_Click()
txtHeight = Me.Height * 0.9
btnResize_Click
End Sub
Private Sub btnWider_Click()
txtWidth = Me.Width * 1.1
btnResize_Click
End Sub
Private Sub btnResize_Click()
On Error Resume Next
Me.Height = txtHeight
Me.Width = txtWidth
ListBox1.Height = Me.Height - ListBox1.Top - 32
On Error GoTo 0
SetTextBoxes
End Sub
Private Sub SetTextBoxes()
txtWidth = Me.Width
txtHeight = Me.Height
End Sub



On strting the initialize event populates the two text boxes. The user can
click one iof the four control buttons (longer, shorter etc) which adjust the
values in the text boxes and resize th eform. Or the user can enter values
and click the resize button



Patrick Molloy
Microsoft Excel MVP



"MD" wrote:

Good day all,

Is there a way to make a userform with a Listbox resizeable by the user?

TIA
MD



  #4   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 292
Default resize my userform

Sure. See FormFun at
http://www.oaltd.co.uk/Excel/Default.htm

HTH. Best wishes Harald

"MD" skrev i melding
.. .
Good day all,

Is there a way to make a userform with a Listbox resizeable by the user?

TIA
MD



  #5   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,489
Default resize my userform

Hi,

Here's an example of resizing the userform using a resize handle without
resorting to APIs.

http://www.andypope.info/vba/resizeform.htm

Cheers
Andy

MD wrote:
Good day all,

Is there a way to make a userform with a Listbox resizeable by the user?

TIA
MD



--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info


  #6   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default resize my userform

Andy,

That's a nice one, I am keeping it.

For what's its worth, here is my modified version of some code
that Greg Koppel posted in April 2002.
Add a spinner to a user form, paste the code into the form module.

'--------------------------------
Private Sub SpinButton1_SpinDown()
Dim sngIncrement As Single
sngIncrement = 5 / UserForm1.Zoom

UserForm1.Height = UserForm1.Height - (sngIncrement * UserForm1.Height)
UserForm1.Width = UserForm1.Width - (sngIncrement * UserForm1.Width)
UserForm1.Zoom = UserForm1.Zoom - 5
Label1.Caption = UserForm1.Zoom
UserForm1.Repaint
End Sub

Private Sub SpinButton1_SpinUp()
Dim sngIncrement As Single
sngIncrement = 5 / UserForm1.Zoom
UserForm1.Height = UserForm1.Height + (sngIncrement * UserForm1.Height)
UserForm1.Width = UserForm1.Width + (sngIncrement * UserForm1.Width)
UserForm1.Zoom = UserForm1.Zoom + 5
Label1.Caption = UserForm1.Zoom
UserForm1.Repaint
End Sub
End Sub
'-------------------------------

Jim Cone
San Francisco, USA




"Andy Pope" wrote in message
...
Hi,
Here's an example of resizing the userform using a resize handle without
resorting to APIs.
http://www.andypope.info/vba/resizeform.htm
Cheers
Andy
Andy Pope, Microsoft MVP - Excel
http://www.andypope.info

  #7   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 3,290
Default resize my userform

PS...

Form also requires a label control.

Jim Cone



"Jim Cone" wrote in message
...
Andy,

That's a nice one, I am keeping it.

For what's its worth, here is my modified version of some code
that Greg Koppel posted in April 2002.
Add a spinner to a user form, paste the code into the form module.

'--------------------------------
Private Sub SpinButton1_SpinDown()
Dim sngIncrement As Single
sngIncrement = 5 / UserForm1.Zoom

UserForm1.Height = UserForm1.Height - (sngIncrement * UserForm1.Height)
UserForm1.Width = UserForm1.Width - (sngIncrement * UserForm1.Width)
UserForm1.Zoom = UserForm1.Zoom - 5
Label1.Caption = UserForm1.Zoom
UserForm1.Repaint
End Sub

Private Sub SpinButton1_SpinUp()
Dim sngIncrement As Single
sngIncrement = 5 / UserForm1.Zoom
UserForm1.Height = UserForm1.Height + (sngIncrement * UserForm1.Height)
UserForm1.Width = UserForm1.Width + (sngIncrement * UserForm1.Width)
UserForm1.Zoom = UserForm1.Zoom + 5
Label1.Caption = UserForm1.Zoom
UserForm1.Repaint
End Sub
End Sub
'-------------------------------

Jim Cone
San Francisco, USA


  #8   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 2,489
Default resize my userform

Thanks Jim glad you like it.

Cheers
Andy

Jim Cone wrote:
Andy,

That's a nice one, I am keeping it.

For what's its worth, here is my modified version of some code
that Greg Koppel posted in April 2002.
Add a spinner to a user form, paste the code into the form module.

'--------------------------------
Private Sub SpinButton1_SpinDown()
Dim sngIncrement As Single
sngIncrement = 5 / UserForm1.Zoom

UserForm1.Height = UserForm1.Height - (sngIncrement * UserForm1.Height)
UserForm1.Width = UserForm1.Width - (sngIncrement * UserForm1.Width)
UserForm1.Zoom = UserForm1.Zoom - 5
Label1.Caption = UserForm1.Zoom
UserForm1.Repaint
End Sub

Private Sub SpinButton1_SpinUp()
Dim sngIncrement As Single
sngIncrement = 5 / UserForm1.Zoom
UserForm1.Height = UserForm1.Height + (sngIncrement * UserForm1.Height)
UserForm1.Width = UserForm1.Width + (sngIncrement * UserForm1.Width)
UserForm1.Zoom = UserForm1.Zoom + 5
Label1.Caption = UserForm1.Zoom
UserForm1.Repaint
End Sub
End Sub
'-------------------------------

Jim Cone
San Francisco, USA




"Andy Pope" wrote in message
...

Hi,
Here's an example of resizing the userform using a resize handle without
resorting to APIs.
http://www.andypope.info/vba/resizeform.htm
Cheers
Andy
Andy Pope, Microsoft MVP - Excel
http://www.andypope.info


--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info
  #9   Report Post  
Posted to microsoft.public.excel.programming
external usenet poster
 
Posts: 1,327
Default resize my userform

Nice one, Andy. Thanks !

Best wishes Harald

"Andy Pope" skrev i melding
...
Hi,

Here's an example of resizing the userform using a resize handle without
resorting to APIs.

http://www.andypope.info/vba/resizeform.htm

Cheers
Andy

MD wrote:
Good day all,

Is there a way to make a userform with a Listbox resizeable by the user?

TIA
MD



--

Andy Pope, Microsoft MVP - Excel
http://www.andypope.info



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
I could NOT resize the axis title but excel allows me to resize gr Iwan Setiyono Ko Charts and Charting in Excel 4 June 6th 06 04:46 AM
I could NOT resize the axis title but excel allows me to resize gr Iwan Setiyono Ko Charts and Charting in Excel 0 March 15th 06 10:34 AM
How to create labels in a UserForm dynamically and be able to resize them with the mouse. Pierre Archambault Excel Programming 0 November 23rd 04 08:39 PM
How to Resize Userform? hce[_26_] Excel Programming 0 October 24th 04 01:19 PM
How to Resize Userform? hce[_25_] Excel Programming 5 October 24th 04 12:12 PM


All times are GMT +1. The time now is 08:55 AM.

Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Copyright ©2004-2025 ExcelBanter.
The comments are property of their posters.
 

About Us

"It's about Microsoft Excel"