I have a document which has formfields (textboxes, checkboxes) which would need to be created as a userform to take advantage of the flexibility of input. Can someone tell me if i can make the word document to look exactly alike in the userform. This question may seem simple but i have my doubts 'coz controls needs to get created dynamically and the pagesetup should the same as the word document.
Any help is greatly appreciated.
Thanks
[Solved] VBA : Word
- FunkyProgrammer
- Closed
-
-
-
Hi FunkyProgrammer,
It maybe possible to create the userform and controls dynamically.
But what does the userform offer that the original formfields don't?Also you may have problems with fitting all the controls on a single userform.
Cheers
Andy -
In word document there is no control when the user types the data in formfields. Whereas userforms have events such as keypress,mouseup/mousedown to know what's happening while the user is typing the input.
Thank you very much for your quick response. -
Formfields do have a Enter & Exit event, to which you can assign code.
Admittedly there is no mouse events.
I will research and post back with info on events for dynamic controls.
Cheers
Andy -
Ok, have a look at this example. I know its a excel one but the approach should still apply to word.
http://www.j-walk.com/ss/excel/tips/tip76.htm
Cheers
Andy -
Hi Andy:
I needed to work with formfields within Word Documents and not use userform at all as per user's needs. i needed to limit the user dynamically to the page limit when he is entering a multi line paragraph which is a textfield in a word doc created to look like a form. I found the solution to this situation is to set the textfield width dynamically .
i.e
activedocument.formfields("textfield name").textinput.width= variable width
this worked for me great.
Thanks for all your help.:yes: -
Hi FunkyProgrammer,
Thanks for the update. And glad to be of help.
Cheers
Andy
Participate now!
Don’t have an account yet? Register yourself now and be a part of our community!