Results 1 to 5 of 5

Thread: How to Change

  1. #1

    Thread Starter
    Member
    Join Date
    Oct 1999
    Posts
    50

    Post

    How do you change the properties of a command button... Checkbox... in a VBA app that these items are Dynamically created.

    Example:
    User opend doc, selects this type and VBA creates next from based on the previous information

    This is in MSWord if it helps any,

    Code that I have so far:
    Selection.InlineShapes.AddOLEControl ClassType:="Forms.CommandButton.1"

    This Creates the Object in the document, How can I change the caption on the Button?

  2. #2
    Hyperactive Member
    Join Date
    Jun 1999
    Location
    Calgary Alberta
    Posts
    359

    Post

    I beleive all the VBA is the same therefore:

    CommandButton1.setfocus
    CommandButton1.caption = "New Caption"

    you have to have the name of the command button, then you set focus to it and rename the caption.

  3. #3

    Thread Starter
    Member
    Join Date
    Oct 1999
    Posts
    50

    Post

    I wish it was that simple, I did try that and I the get and object required error 424

    Any other Ideas?

  4. #4
    Hyperactive Member
    Join Date
    Jun 1999
    Posts
    308

    Post

    Hi, Spyder.

    Try this:

    Dim myCB As Object
    Set myCB = ActiveDocument.Shapes.AddOLEControl(ClassType:="Forms.CommandButton.1")
    With myCB.OLEFormat.Object

    .Caption = "Check if over 21"
    End With

    Larisa

  5. #5

    Thread Starter
    Member
    Join Date
    Oct 1999
    Posts
    50

    Post

    Thanks, It worked

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