Results 1 to 15 of 15

Thread: How do I dynamically create textboxes in a custom word form - Resolved

Threaded View

  1. #1

    Thread Starter
    Super Moderator FunkyDexter's Avatar
    Join Date
    Apr 2005
    Location
    An obscure body in the SK system. The inhabitants call it Earth
    Posts
    7,957

    How do I dynamically create textboxes in a custom word form - Resolved

    I have a customer form fired up from a word macro and I want to create a number of textboxes on it. I have to create them dynamically as I don't know how many at design time.

    My own investigations and a trawl round the forums pointed me at 2 possible ways of achieving it but neither's working for me:-

    1 txtBox = Me.Controls.Add(progid, "txtField", True) The problem here is I can't work out the progid for a text box - various sources quote VB.TextBox but word doesn't seem to recognise VB - maybe I just need to add a reference but I can't work out which.

    2 Create an control array with a single element and then 'load' it to create new instances of the control in the array, something like: Load txtField(1) The problem with this one is that word doesn't seem to support control arrays - the text box has no index property and if I try to add an identically named control it barfs and tells me the name's ambiguous, no option to create an array.

    So can anyone tell me how to:-
    get the progID in word for a text box
    or
    create a control array in word
    or
    do something else entirely?

    Thanks in advance
    Last edited by FunkyDexter; Jun 22nd, 2005 at 04:01 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width