Need Help Editing a Document Based on Dialog Box Options 
Author Message
 Need Help Editing a Document Based on Dialog Box Options

I'm using Word 97.  I have a dialog box with several option buttons.  I
need to make the macro add specific text to the document based on the
option that is selected in the dialog box.

I have several bookmarks defined in the document, so I can use simple
Selection.Goto commands to move from one bookmark to the next, and I know
how to add the text to the document.  What I can't get a handle on is the
macro branching based on the selected dialog box option.

Assume that I have a simple dialog box with option buttons labeled
"Option 1" and "Option 2", and an OK button (my actual dialog box is
almost that simple).  Can someone give me a simple example macro that
adds the text "Option 1" to the document when Option 1 is selected in the
dialog box, and "Option 2" when Option 2 is selected in the dialog box?

--

Please reply to the newsgroup so that all may learn
from your wisdom.

--Tom



Sat, 12 Oct 2002 03:00:00 GMT  
 Need Help Editing a Document Based on Dialog Box Options
Hi Tom,

The following should get you started.

--------------------------------------------------------------

Private Sub CommandButton1_Click()

If OptionButton1.Value = True Then
    ActiveDocument.Bookmarks("Option"). _
        Range.Text = "Option 1"
ElseIf OptionButton2.Value = True Then
    ActiveDocument.Bookmarks("Option"). _
        Range.Text = "Option 2"
Else
    MsgBox "No Option Selected."
End If

End Sub

--------------------------------------------------------------

Hope this helps.
Regards
ibby

Please post replies or follow-ups to the **newsgroup** so that participants
may benefit or contribute.


Quote:
> I'm using Word 97.  I have a dialog box with several option buttons.  I
> need to make the macro add specific text to the document based on the
> option that is selected in the dialog box.

> I have several bookmarks defined in the document, so I can use simple
> Selection.Goto commands to move from one bookmark to the next, and I know
> how to add the text to the document.  What I can't get a handle on is the
> macro branching based on the selected dialog box option.

> Assume that I have a simple dialog box with option buttons labeled
> "Option 1" and "Option 2", and an OK button (my actual dialog box is
> almost that simple).  Can someone give me a simple example macro that
> adds the text "Option 1" to the document when Option 1 is selected in the
> dialog box, and "Option 2" when Option 2 is selected in the dialog box?

> --

> Please reply to the newsgroup so that all may learn
> from your wisdom.

> --Tom



Sun, 13 Oct 2002 03:00:00 GMT  
 Need Help Editing a Document Based on Dialog Box Options

Quote:
> Hi Tom,

> The following should get you started.

> --------------------------------------------------------------

> Private Sub CommandButton1_Click()

> If OptionButton1.Value = True Then
>     ActiveDocument.Bookmarks("Option"). _
>         Range.Text = "Option 1"
> ElseIf OptionButton2.Value = True Then
>     ActiveDocument.Bookmarks("Option"). _
>         Range.Text = "Option 2"
> Else
>     MsgBox "No Option Selected."
> End If

> End Sub

Thanks!  I got it working.  I just couldn't seem to find what I needed in
the on-line Help.

--

Please reply to the newsgroup so that all may learn
from your wisdom.

--Tom



Mon, 14 Oct 2002 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Need Simple Dialog box for document merge.

2. Need Help Formatting Options Dialog: puttig elements on 2nd - nth tabs

3. Find dialog box options

4. setting SaveAs dialog box options

5. Internet Option Dialog Box

6. Options Dialog Box

7. How to create dialog box with option group

8. Internet Options Dialog Box - Best way to call

9. Select Names dialog box opens, need help getting the recipients into strings

10. HELP - Need to Suppress Dialog Boxes w/in Macros

11. SIMPLE HELP NEEDED - Saving a text file using a common dialog box

12. Help needed opening CSV file with Common Dialog Box

 

 
Powered by phpBB® Forum Software