Very simple question:
Given a userform with ComboBoxHorizontalAlign populated with the values "Left", "Right", and "Center", and a current Value of "Left"
What am I missing?![]()
Please Login or Register to view this content.
Very simple question:
Given a userform with ComboBoxHorizontalAlign populated with the values "Left", "Right", and "Center", and a current Value of "Left"
What am I missing?![]()
Please Login or Register to view this content.
![]()
Please Login or Register to view this content.
Entia non sunt multiplicanda sine necessitate
Sigh..... I know I can do that..... is that really the only way? I have to trade out one clean line of code for a lengthy Case statement?
I appreciate the help, shg.
It gets worse in another place that I hadn't mentioned before: Paper Sizes.
There are Excel constants for approximately 40 different paper sizes. I have a function that queries my printer and checks to see what page sizes are available. It would sure be nice to dump an item selected from that list straight to the .PaperSize item, instead of having to write a Select with 40 Cases.
I know... I'm whining... and hoping someone has a better way.
In VBA, name binding of constants and simple variables to the identifiers that reference them occurs at compile time; i.e., they are statically bound.
You could put them in a collection, using left/right/center/whatever as the key and the enumeration value as the item:
![]()
Please Login or Register to view this content.
Last edited by shg; 12-09-2014 at 08:15 PM.
Richard Buttrey
RIP - d. 06/10/2022
If any of the responses have helped then please consider rating them by clicking the small star iconbelow the post.
Hello diakonos1984,
Maybe this option would be more appealing...
![]()
Please Login or Register to view this content.
Sincerely,
Leith Ross
Remember To Do the Following....
1. Use code tags. Place [CODE] before the first line of code and [/CODE] after the last line of code.2. Thank those who have helped you by clicking the Starbelow the post.
3. Please mark your post [SOLVED] if it has been answered satisfactorily.
Old Scottish Proverb...
Luathaid gu deanamh maille! (Rushing causes delays!)
Thank you for those helpful suggestions.
I may use Leith's concise Switch for the alignments and shg's Collection item for the paper sizes.
The paper size constants range from 1 to 41 (excluding xlPaperUser which is 256) so if you load the combobox in the correct order, you could simply add 1 to the ListIndex to get the correct xlPaperSize value.
Everyone who confuses correlation and causation ends up dead.
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks