change value of option button (OLE object) in Microsoft Word file

Discussion in 'AppleScript' started by bnquynhnhu, Oct 1, 2008.

  1. bnquynhnhu

    bnquynhnhu New Member

    Joined:
    Oct 1, 2008
    Messages:
    2
    Likes Received:
    0
    Hi guys,

    I would like to convert a macro from VBA to AppleScript. Unfortunately, I'm the beginner of AppleScript and I don't know how to change value of an option button in Microsoft Word.

    For example, I have an option button with 2 options (group name = question413) Yes and No. Now, I would like to open Word file, then change value of option button with group name "question413" to Yes. Below is my code in VBA.

    SetOptionButton "question413", "Yes"

    Public Sub SetOptionButton(GroupName As String, Value As String)
    Dim oShape As Word.InlineShape
    For Each oShape In ActiveDocument.InlineShapes
    If oShape.OLEFormat.ProgID = "Forms.OptionButton.1" Then
    If oShape.OLEFormat.Object.GroupName = GroupName Then
    If oShape.OLEFormat.Object.Caption = Trim(Value) Then
    oShape.OLEFormat.Object.Value = True
    Else
    oShape.OLEFormat.Object.Value = False
    End If
    End If
    End If
    Next
    End Sub

    How could I convert them to AppleScript?Any comments would be highly appreciated.

    Thanks,
     
    bnquynhnhu, Oct 1, 2008
    #1
    1. Advertisements

  2. bnquynhnhu

    bnquynhnhu New Member

    Joined:
    Oct 1, 2008
    Messages:
    2
    Likes Received:
    0
    Help me, please. :(
     
    bnquynhnhu, Oct 2, 2008
    #2
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.