Consulting

Results 1 to 4 of 4

Thread: Excel Userform with Checkbox value, How to return to Checkbox value in Winword

  1. #1
    VBAX Regular
    Joined
    Feb 2017
    Location
    Hong Kong
    Posts
    33
    Location

    Excel Userform with Checkbox value, How to return to Checkbox value in Winword

    How to use Excel Userform with Checkbox / Option Button value,
    then return value to Checkbox / Textbox / Option Button in Winword Form

    1) Use the "Print Report" Button, Red Box in figure
    2) Get the Checkbox value from Excel Userform
    3) Print the information onto Winword Application form. Green & Blue Box in figure
    4) I know below coding is not correct, But I am trying to explain my wishes.

    Pseudo Code:
    :
    :
    :
    ' Green Box in figure
    If Optionbutton1.value = true then
    doc.tables(1).Cell(4,2).Optionbutton1.value = True
    Else
    doc.tables(1).Cell(4,2).Optionbutton2.value = False
    End if

    ' Blue Box in figure
    If Checkbox1.value = True then
    doc.tables(1).Cell(6,1).CheckBox1.value = True
    Else
    doc.tables(1).Cell(6,1).CheckBox1.value = False
    End if

    If Checkbox2.value = True then
    doc.tables(1).Cell(6,2).CheckBox2.value = True
    Else
    doc.tables(1).Cell(6,2).CheckBox2.value = False
    End if
    :
    :
    :
    If Checkbox6.value = True then
    doc.tables(1).Cell(7,3).CheckBox6.value = True
    Else
    doc.tables(1).Cell(7,3).CheckBox6.value = False
    End if
    :
    :
    :
    Attached Images Attached Images

  2. #2
    VBAX Regular
    Joined
    Feb 2017
    Location
    Hong Kong
    Posts
    33
    Location
    Master,

    Pls guide me how to fix the request.

    I would like someone who can answer me or you can says no method to do this for VBA, I m worry about the case long time .

  3. #3
    VBAX Mentor 大灰狼1976's Avatar
    Joined
    Dec 2018
    Location
    SuZhou China
    Posts
    479
    Location
    Hi justuptou!
    ActiveX controls on the same document have unique names,
    So you can assign values directly to controls like below:
    ActiveDocument.OptionButton1 = True

  4. #4
    VBAX Mentor 大灰狼1976's Avatar
    Joined
    Dec 2018
    Location
    SuZhou China
    Posts
    479
    Location
    Please refer to the attachment.
    Attached Files Attached Files

Posting Permissions

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