Hello everyone
I am trying to resize the userform so as to fit the screen and at the same time to resize the controls on it .. I have found classes modules which I think is related to the subject but I don't know why it doesn't work properly
I have attached the sample file with my attempts ..
Thanks advanced for help
Resize userform to fill the screen and resize the controls
-
- PlatinumLounger
- Posts: 4936
- Joined: 31 Aug 2016, 09:02
Resize userform to fill the screen and resize the controls
You do not have the required permissions to view the files attached to this post.
-
- Administrator
- Posts: 78686
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Resize userform to fill the screen and resize the contro
Doesn't the site where you found the class modules provide an example?
Best wishes,
Hans
Hans
-
- PlatinumLounger
- Posts: 4936
- Joined: 31 Aug 2016, 09:02
Re: Resize userform to fill the screen and resize the contro
In fact this was a code that I kept in a text file and I don't remember the source ..
-
- Administrator
- Posts: 78686
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Resize userform to fill the screen and resize the contro
OK, I found the source - it's from Andy Pope: Anchor controls and resizing userform
Please download the sample workbook from that page and use that - your workbook is missing some essential parts of the code.
Please download the sample workbook from that page and use that - your workbook is missing some essential parts of the code.
Best wishes,
Hans
Hans
-
- 4StarLounger
- Posts: 475
- Joined: 21 Feb 2020, 21:27
- Location: Vermont (USA)
Re: Resize userform to fill the screen and resize the contro
I'm glad to see this, for future reference.
—Nick
I’m only an egg (but hard-boiled)
I’m only an egg (but hard-boiled)
-
- PlatinumLounger
- Posts: 4936
- Joined: 31 Aug 2016, 09:02
Re: Resize userform to fill the screen and resize the contro
I don't know what's missing.. I have two class modules and standard module with some public variables (enumAnchorStyles)
I think I have to deal with each control on the userform ..
My final target is fit the userform to the whole screen and at the same time to resize the controls according to the screen resolution.
I think I have to deal with each control on the userform ..
My final target is fit the userform to the whole screen and at the same time to resize the controls according to the screen resolution.
-
- Administrator
- Posts: 78686
- Joined: 16 Jan 2010, 00:14
- Status: Microsoft MVP
- Location: Wageningen, The Netherlands
Re: Resize userform to fill the screen and resize the contro
1) Add the following line at the end of UserForm_Initialize:
2) Add blocks similar to
for each control that you want to resize. It's up to you to figure out which settings you need for each control.
Code: Select all
UserForm_Resize
Code: Select all
With .Anchor("Frame1")
.anchorStyle = enumAnchorStyleLeft Or enumAnchorStyleRight Or enumAnchorStyleBottom Or enumAnchorStyleTop
.minimumHeight = 120
End With
Best wishes,
Hans
Hans
-
- PlatinumLounger
- Posts: 4936
- Joined: 31 Aug 2016, 09:02
Re: Resize userform to fill the screen and resize the contro
Thanks a lot, Mr. Hans
I will try to adjust the rest of the controls.
I will try to adjust the rest of the controls.