If condition with TextBox ?

P

Peter

I have a problem with writing the proper VBA code.
In textbox (named kspsr) I write a value e.g 5 and I'd like to create VBA
formula which would take into account this value and in dependence of
conditions show the proper result in the bookmark's (named klas) place in my
document.

For example

If kspsr > 5 Then klas = "YES"
If kspr <=5 Then klas = "NO"

What should be the proper VBA formula ? I know it's very simple but I cannot
do it.
Thanks for your help
Peter
 
J

Jezebel

Something like

Dim pResult as string

If kspsr > 5 Then
pResult = "YES"
else
pResult = "NO"
end if
Activedocument.Bookmarks("klas").Range = pResult
 
P

Peter

I don't it still doesn't work.
Once again.
I have a textbox (named kspsr). I write a number (e.g. 5) in it. In document
I have bookmark (named klas) which passes the answer in dependence what
number was writing in textbox (kspsr).
If this number (kspsr) is higher than 4.5 then bookmark (klas) should have
solution (YES), if not (NO).
I'm looking forward to your replies
Peter
 
Top