Home |
Search |
Today's Posts |
#1
Posted to microsoft.public.word.newusers
|
|||
|
|||
Create error msg based on calculation result in formfield using VBA
I have a protected Word 03 form with a 2 column table in it (A1:B8).
In the table are 3 manual entry textbox fields that you can enter dollar amounts into (B1, B2 & B3), and the remaining 5 fields (B4, B5, B6, B7 & B8) have formula calculations. B4 is the sum of B2+B3. B5 is a percentage ratio of B1/B4. Basically what I'm trying to do is pop up an error message when B4 (the sum of B2+B3) is less than the dollar amount entered into B1. Or another way of writing it is if B5 is greater than 100%, I need the error message to pop up. Sometimes my code works, sometimes not, and I've written many different ways, spending many different days (& nights), but to no avail. I've tried declaring the variables as currency, integer & string, but I'm just missing something with my programming inexperience. Any help would be greatly appreciated! Sub Main() Dim oFld As FormFields Dim strNum As String Set oFld = ActiveDocument.FormFields strNum = oFld("Text36").Result strNum = oFld("Text39").Result If oFld ("Text36").Result oFld("Text39").Result Then MsgBox "CELL B1 EXCEEDS CELL B4" & vbCrLf & "Use Alternate Calculation" End If End Sub |
Reply |
Thread Tools | |
Display Modes | |
|
|
Similar Threads | ||||
Thread | Forum | |||
Create error msg based on calculation result in formfield using VBA | New Users | |||
Inserting Text based of an Equation Result | Microsoft Word Help | |||
Error! Not a valid result for table. | Microsoft Word Help | |||
Changing FormField result in Macro does not change link | Microsoft Word Help | |||
Result based on drop down | Microsoft Word Help |