Consulting

Results 1 to 6 of 6

Thread: VBA word - adding a: row to a table, label and combobox

Hybrid View

Previous Post Previous Post   Next Post Next Post
  1. #1
    VBAX Newbie
    Joined
    Jul 2017
    Location
    Tilburg
    Posts
    5
    Location

    VBA word - adding a: row to a table, label and combobox

    Dear programmers,

    I'm not a progammer, i can program a little bit bu with a lot of help and research and even then it ain pretty...
    I hope you can help me with he following problem.
    In the attachement is a word file with on the 3rd page an button : Add step.

    The program must add an row to the table above (in this case to row 7), including a combobox and label. This needs to be in the same stye and format as the row above (7), in other words, it needs to be copied.
    The caption of the label (in the new created row) is depended on the value of the combobox at the same (new) row.

    So far my coding generates a new row with label and combobox only not in the same style/format as the row above. (it dumps it on te screen).

    There is an classmodule made,when i run it (with the vba coder, otherwise it wouldn't work) it couples the combobox to the label.

    The problem i have and what i can't figure out is placing the label and combobox at the correct coördinate's and couple them as now is done in the classmodule...

    The program is for making plans with correct terminology. Row 7 is added just to show how it should look.

    Many thank in advance!

    With kind regards,
    Attached Files Attached Files

  2. #2
    Knowledge Base Approver VBAX Guru macropod's Avatar
    Joined
    Jul 2008
    Posts
    4,435
    Location
    If you save your document in the docm format and use a content control dropdown or combobox (either of which you can pre-populate) instead of the ActiveX combobox, you could use the code in either of the following for your automation - without the need for the ActiveX command button:
    http://www.msofficeforums.com/word-v...html#post87989
    http://www.msofficeforums.com/word-v...html#post38461
    Cheers
    Paul Edstein
    [Fmr MS MVP - Word]

  3. #3
    VBAX Newbie
    Joined
    Jul 2017
    Location
    Tilburg
    Posts
    5
    Location
    Thanks, In the last link is a document (Table row add) that i can use.
    Is it possible to show in one of the text fields the value of the dropdown menu?
    And when it copies the previous row, does it also link the textbox to the dropdown menu in the same row?

    Thanks in advance!

  4. #4
    Knowledge Base Approver VBAX Guru macropod's Avatar
    Joined
    Jul 2008
    Posts
    4,435
    Location
    There are no fields or textboxes in that implementation, so it's not apparent what you mean.
    Cheers
    Paul Edstein
    [Fmr MS MVP - Word]

  5. #5
    VBAX Newbie
    Joined
    Jul 2017
    Location
    Tilburg
    Posts
    5
    Location
    Sorry, sometimes in my mind i'm two steps ahead...

    In the file is an sort of dropbox, in de cell next to it i want a textfield or label that shows the value of the dropbox. example: example: the user selects "measure" from the dropbox than in de label in the cell next to it, it should display: Measure voltage at:

    [dropbox] [label]
    Mausure measure at

    Measure

  6. #6
    Knowledge Base Approver VBAX Guru macropod's Avatar
    Joined
    Jul 2008
    Posts
    4,435
    Location
    If you want a dropdown content control with dependent output, you might use something like the approach in:
    http://www.msofficeforums.com/word-v...html#post46903
    Cheers
    Paul Edstein
    [Fmr MS MVP - Word]

Posting Permissions

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