If I create a VBA userform on my laptop, then put it on a desktop, often I have to make major changes so that it displays correctly.
Is there somewhere I can set something that will force the userform to display correctly on either machine?
If I create a VBA userform on my laptop, then put it on a desktop, often I have to make major changes so that it displays correctly.
Is there somewhere I can set something that will force the userform to display correctly on either machine?
You could define it as a percentage, I'm still learning myself, but something along these lines:
Please Login or Register to view this content.
After posting my weak attempt at this problem I did a search for possible solutions and found one that works on my 32bit machine, and resizes to what I input, but I do not have another 32bit machine I can try it on(and it did NOT work on my 64 bit machines), it seems promising though.
That code was found at LINK written by user "gn00588950".Please Login or Register to view this content.
That looks like it might work, once I establish the percentage required.
I was thinking that if the resolution got changed, then the percentage would also have to change.
I was hoping that the may be a way of standardising it, so if the resolution went up or down the userform would remain the same size. This would mean the userform would always need to be a ratio of the display screen, no matter what resolution or zoom.
I copy a module to each project I have forms in then callfrom the Form initialize event. (The first argument is the form itself, the other 2 are self explanatory)Please Login or Register to view this content.
I cant recall all of the places I pulled this code together from over years so if anybody wants to claim credit, please notify me and I will add an acknowledgement.
Please Login or Register to view this content.
*******************************************************
HELP WANTED! (Links to Forum threads)
Trying to create reusable code for Custom Events at Workbook (not Application) level
*******************************************************
Thank you for you help Spencer, we have 64 bit machines so I will be looking at mc84excel's solution.
mc84excel, again thank you for your solution. It looks very complex to me, but as we use a lot of forms it will be well worth the effort trying to learn it.
Thanks for the rep kjg.
Re complexity = In that there is a lot of code or you need assistance using?
If the former - the code will contain several functions that are not relevant to your request (e.g. ArrowKeysChangeSelectedItemInFormListBox). I removed some that weren't of interest but didn't have time/effort to find and remove all! (I use these modules as reusable code. I export them so I can then drag/drop the template into any VBA project whenever I need any of the functions in that template module)
Also I should warn you that this code hasn't been tested for 64 bit compatibility (I prefer to install Excel as 32 bit). Only the 'GetSystemMetrics' API has been finished. Can anybody provide 64 bit compatible versions for the other APIs?
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks