A
Andre
Thanks to all your help, I'm much farther on the project than I had
been before I found this newsgroup. However, it seems that everytime
I thought I understood how things work, it doesn't work the way I
thought it would. Here's my dilemma, I have a dropdown list with text
selections for the user. I am now able to recognize which item is
selected and make that into a document variable. Now I need to create
another variable whose value is dependent on what is selected. Thanks
to your help, I'm now able to use CASE statement. But here's what
happened. I put a watch on the variable BeltType to ensure that I'm
looking at the right one. I use INSTR to search for a string within
the BeltType document variable. The BeltType variable is changing
according to what the user selects, but the Case statement isn't doing
its job. It's not changing the variable BeltTypePrice to the
appropriate one. What am I doing wrong in the Case statement?
Thank you very much,
Andre S
Sub BeltType()
'
' BeltType Macro
' Macro created 9/7/2003 by AndreS
'
Dim BeltType
ActiveDocument.Variables("BeltType").Value =
ActiveDocument.FormFields("BeltType").Result
BeltType = ActiveDocument.FormFields("BeltType").Result
Select Case BeltType
Case InStr(BeltType, "WMX-2222") > 0
BeltTypePrice = 0.75
Case InStr(BeltType, "WMX-2222 Oil") > 0
BeltTypePrice = 0.825
Case InStr(BeltType, "330#") > 0
BeltTypePrice = 0.775
Case InStr(BeltType, "3332 Oil") > 0
BeltTypePrice = 0.875
Case Else ' should never get here
MsgBox "Invalid BeltType"
End Select
ActiveDocument.Variables("BeltTypePrice").Value = BeltTypePrice
End Sub
been before I found this newsgroup. However, it seems that everytime
I thought I understood how things work, it doesn't work the way I
thought it would. Here's my dilemma, I have a dropdown list with text
selections for the user. I am now able to recognize which item is
selected and make that into a document variable. Now I need to create
another variable whose value is dependent on what is selected. Thanks
to your help, I'm now able to use CASE statement. But here's what
happened. I put a watch on the variable BeltType to ensure that I'm
looking at the right one. I use INSTR to search for a string within
the BeltType document variable. The BeltType variable is changing
according to what the user selects, but the Case statement isn't doing
its job. It's not changing the variable BeltTypePrice to the
appropriate one. What am I doing wrong in the Case statement?
Thank you very much,
Andre S
Sub BeltType()
'
' BeltType Macro
' Macro created 9/7/2003 by AndreS
'
Dim BeltType
ActiveDocument.Variables("BeltType").Value =
ActiveDocument.FormFields("BeltType").Result
BeltType = ActiveDocument.FormFields("BeltType").Result
Select Case BeltType
Case InStr(BeltType, "WMX-2222") > 0
BeltTypePrice = 0.75
Case InStr(BeltType, "WMX-2222 Oil") > 0
BeltTypePrice = 0.825
Case InStr(BeltType, "330#") > 0
BeltTypePrice = 0.775
Case InStr(BeltType, "3332 Oil") > 0
BeltTypePrice = 0.875
Case Else ' should never get here
MsgBox "Invalid BeltType"
End Select
ActiveDocument.Variables("BeltTypePrice").Value = BeltTypePrice
End Sub