userform resize

my apologies for this thread if it already exists. I was unable to find anything regarding this subject.

in a vba userform, how do you make the userform size to change by stretching with the mouse or maximized to the screen on load and possibly a percentage of that maximize? Most if not all of the information I find is about using a command button to control this which I have tested but it would be better if the form sized itself based on the resolution of the users machine, either by a different screen resolution or monitor size. The methods noted in most of the forums and videos around anything except Bentley are not available in MVBA such as Application.WindowState. If I could get the size of the active application (ie, MicroStation) I could at least work with that.

Any ideas?

Thanks,

Mark W.

Parents
  • Hi Mark,

    becasue VBA Forms are designed to be not resizable by default, an effort to workaround this feature is about finding hacks (there are similar discussions typically  related to Excel). Despite of I agree it can be useful, it makes the code more complex and it's a kind of proof you choose wrong tool. VBA is not the right one.

    I remember I saw a solution some time ago and it was based on direct Win32 API calls. I don't remember details, but even at this time my feeling was C# WinForms seems to be better solution with far simpler code.

    BTW There are Application.Height and Application.Width properties that can be used to check MicroStation windows size. But who knows how it works when multimonitor configuration and/or more MicroStation windows are used...

Reply
  • Hi Mark,

    becasue VBA Forms are designed to be not resizable by default, an effort to workaround this feature is about finding hacks (there are similar discussions typically  related to Excel). Despite of I agree it can be useful, it makes the code more complex and it's a kind of proof you choose wrong tool. VBA is not the right one.

    I remember I saw a solution some time ago and it was based on direct Win32 API calls. I don't remember details, but even at this time my feeling was C# WinForms seems to be better solution with far simpler code.

    BTW There are Application.Height and Application.Width properties that can be used to check MicroStation windows size. But who knows how it works when multimonitor configuration and/or more MicroStation windows are used...

Children