9 Replies - 1035 Views - Last Post: 30 March 2018 - 08:37 AM Rate Topic: -----

#1 UnicornBlu   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 29-March 18

WORD 2k10 OptionButtons to calculate..HELP! :(

Posted 29 March 2018 - 02:14 PM

I'm using Word 2010. I'm using OptionButtons. I want OptionButton 1 value to =25, OptionButton2=50, OptionButton3=75, OptionButton0=0 . I would like to display the value of the option button chosen. I'd like to use a textbox where I would like to display the total value of the OptionButton selected. Can someone please show me or write out which ever works best how to get the Optionbuttons to calculate =Selected value x25 and whats the vba code. im having such a hard time. im very new to this stuff.

Is This A Good Question/Topic? 0
  • +

Replies To: WORD 2k10 OptionButtons to calculate..HELP! :(

#2 modi123_1   User is offline

  • Suitor #2
  • member icon



Reputation: 14685
  • View blog
  • Posts: 58,688
  • Joined: 12-June 08

Re: WORD 2k10 OptionButtons to calculate..HELP! :(

Posted 29 March 2018 - 02:15 PM

This is a VBA macro?

What have you tried, thought about, or considered?
Was This Post Helpful? 0
  • +
  • -

#3 UnicornBlu   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 29-March 18

Re: WORD 2k10 OptionButtons to calculate..HELP! :(

Posted 30 March 2018 - 07:52 AM

im trying to get the option buttons to calculate but nothing is working. here is the pic: https://ibb.co/iWN20S

my vba code:
Dim lngX As Long
Private Sub OptionButton_1_3_Click()
If OptionButton1.Value = True Then
    lngX = 3
End If
Activedocument.Variables("varOne").Value = 25 * lngX
Activedocument.Range.Fields.Update
End Sub
Private Sub OptionButton_1_2_Click()
If OptionButton2.Value = True Then
    lngX = 2
End If
Activedocument.Variables("varOne").Value = 25 * lngX
Activedocument.Range.Fields.Update
End Sub
Private Sub OptionButton_1_1_Click()
If OptionButton3.Value = True Then
    lngX = 1
End If
Activedocument.Variables("varOne").Value = 25 * lngX
Activedocument.Range.Fields.Update
End Sub
Private Sub OptionButton_1_0_Click()
If OptionButton4.Value = True Then
    lngX = 0
End If
Activedocument.Variables("varOne").Value = 25 * lngX
Activedocument.Range.Fields.Update
End Sub
:code:

If i can get this to work. i will be forever grateful

*correct code*
my vba code:
Dim lngX As Long
Private Sub OptionButton_1_3_Click()
If OptionButton_1_3_.Value = True Then
lngX = 3
End If
Activedocument.Variables("varOne").Value = 25 * lngX
Activedocument.Range.Fields.Update
End Sub
Private Sub OptionButton_1_2_Click()
If OptionButton_1_2_.Value = True Then
lngX = 2
End If
Activedocument.Variables("varOne").Value = 25 * lngX
Activedocument.Range.Fields.Update
End Sub
Private Sub OptionButton_1_1_Click()
If OptionButton_1_1_.Value = True Then
lngX = 1
End If
Activedocument.Variables("varOne").Value = 25 * lngX
Activedocument.Range.Fields.Update
End Sub
Private Sub OptionButton_1_0_Click()
If OptionButton_1_0_Value = True Then
lngX = 0
End If
Activedocument.Variables("varOne").Value = 25 * lngX
Activedocument.Range.Fields.Update
End Sub

If i can get this to work. i will be forever grateful

This post has been edited by modi123_1: 30 March 2018 - 07:52 AM
Reason for edit:: In the future please use the [code] tag button in the editor.

Was This Post Helpful? 0
  • +
  • -

#4 modi123_1   User is offline

  • Suitor #2
  • member icon



Reputation: 14685
  • View blog
  • Posts: 58,688
  • Joined: 12-June 08

Re: WORD 2k10 OptionButtons to calculate..HELP! :(

Posted 30 March 2018 - 08:05 AM

Mmm. Come on now.. if you want to learn this you gotta put some effort into it. You are just copy/pasting what some MVP over on Microsoft gave you. :/

https://answers.micr...67-2e87a1416c86
Was This Post Helpful? 0
  • +
  • -

#5 UnicornBlu   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 29-March 18

Re: WORD 2k10 OptionButtons to calculate..HELP! :(

Posted 30 March 2018 - 08:16 AM

i really don't understand how to do it. :(
Was This Post Helpful? 0
  • +
  • -

#6 modi123_1   User is offline

  • Suitor #2
  • member icon



Reputation: 14685
  • View blog
  • Posts: 58,688
  • Joined: 12-June 08

Re: WORD 2k10 OptionButtons to calculate..HELP! :(

Posted 30 March 2018 - 08:23 AM

Is this homework?
Was This Post Helpful? 0
  • +
  • -

#7 UnicornBlu   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 29-March 18

Re: WORD 2k10 OptionButtons to calculate..HELP! :(

Posted 30 March 2018 - 08:28 AM

yes it is. i got until monday to at least get something working. i have no clue at all. i cant get anyone to fully help me and its really stressful.
Was This Post Helpful? 0
  • +
  • -

#8 modi123_1   User is offline

  • Suitor #2
  • member icon



Reputation: 14685
  • View blog
  • Posts: 58,688
  • Joined: 12-June 08

Re: WORD 2k10 OptionButtons to calculate..HELP! :(

Posted 30 March 2018 - 08:30 AM

Well.. yeah. Folk should not be doing your homework for you. That doesn't help you learn what you need to know, or provide you any education foundation for future work.

I assume you have a book on the topic? Some sort of study aide? Review that.

Barring that Microsoft has great tutorials on macros.
https://msdn.microso...us/vba/vba-word
https://msdn.microso...office.14).aspx
https://msdn.microso...h-vba-in-office

Read those and start to get a solution framed out.
Was This Post Helpful? 0
  • +
  • -

#9 UnicornBlu   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 7
  • Joined: 29-March 18

Re: WORD 2k10 OptionButtons to calculate..HELP! :(

Posted 30 March 2018 - 08:36 AM

i really dont have a book for it. my professor dont speak english real well but the notes we take is not really helping. not asking for anyone to do my work for me. i just need see an example or such on how to get it running. i been googling and youtubing my life away since i got the assignment. im just at lost end.
Was This Post Helpful? 0
  • +
  • -

#10 modi123_1   User is offline

  • Suitor #2
  • member icon



Reputation: 14685
  • View blog
  • Posts: 58,688
  • Joined: 12-June 08

Re: WORD 2k10 OptionButtons to calculate..HELP! :(

Posted 30 March 2018 - 08:37 AM

Ok.. then start with the Microsoft docs I linked. Read through them and get your feet under you for macros.
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1