By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,700 Members | 1,512 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,700 IT Pros & Developers. It's quick & easy.

Programatically convert a textbox to combobox and back

P: 38
is there anyway to programatically in VBA code convert a textbox to a combobox (set it's control source) and then later convert it back to a text box?

Much appreciated.
Salzan
Feb 15 '08 #1
Share this Question
Share on Google+
3 Replies


ADezii
Expert 5K+
P: 8,704
is there anyway to programatically in VBA code convert a textbox to a combobox (set it's control source) and then later convert it back to a text box?

Much appreciated.
Salzan
I'm pretty sure the appropriate Commands to do the conversion would be:
Expand|Select|Wrap|Line Numbers
  1. Application.RunCommand acCmdChangeToComboBox
  2. Application.RunCommand acCmdChangeToTextBox
The problem as far as I understand it would be that the Form containing the Control must be in Design View, and you would need some Method that would shift focus to the Control before the Commands are applied. Just for curiosity, why would you want to do this? Wouldn't it be simpler to overlay the Controls, then manipulate them in this manner?
Feb 15 '08 #2

P: 38
Thank you very much. WHile I was waiting for a reply I got the idea to create two controls and overlay them and then make one or the other visible depending on which one I want to show. So in effect I took your advise. Thanks.
Feb 15 '08 #3

ADezii
Expert 5K+
P: 8,704
Thank you very much. WHile I was waiting for a reply I got the idea to create two controls and overlay them and then make one or the other visible depending on which one I want to show. So in effect I took your advise. Thanks.
You are quite welcome, I really don't think that you would want to use the prior approach.
Feb 15 '08 #4

Post your reply

Sign in to post your reply or Sign up for a free account.