not equal to

C

C''''est_moi

Again, in dire need of help. I need to have a sentence disappear if the
result of two different DD (each with 10 choices in them) is NOT equal to
something (both results are the same, below "AAA").

If ActiveDocument.FormFields("xxx").Result = "AAA" Or
ActiveDocument.FormFields("yyy") = "AAA" then

That is the command that I came up with and which works perfectly fine in
erasing my sentence but I want the contrary. I tried adding

= false

at the end but that does not work either. And I cannot find any "is not
equal to" command.

Merci/Thank you for any help anyone can provide.

Carmen
 
G

Greg Maxey

Not sure I understand exactly what you are looking for, but one of the two
OR or AND functions illustrated below should work:

Sub ScratchMacro()
Dim pAstr As String
Dim pBStr As String
pAstr = "AAA"
pBStr = "AZA"
If Not pAstr = "AAA" Or Not pBStr = "AAA" Then
MsgBox "Do this"
Else
MsgBox "Do that"
End If
If Not pAstr = "AAA" And Not pBStr = "AAA" Then
MsgBox "Do this"
Else
MsgBox "Do that"
End If
End Sub
 
C

C''''est_moi

Thank you Greg. This seems a little advanced for me. I solved the problem for
now like this

IF "my command below"
exit sub (thus nothing happens and the sentence stays where I want it to stay)
ELSE "delete sentence I wanted to delete".

So, if I user chooses AAA in DD1 OR in DD2, the sentence stays. If user
chooses anything else than AAA, sentence is erased.

Thx again for your quick reply.
 
M

macropod

Hi Carmen,

Another approach would be:
If Not ActiveDocument.FormFields("xxx").Result = "AAA"

--
Cheers
macropod
[MVP - Microsoft Word]


macropod said:
Hi,

How about:
If ActiveDocument.FormFields("xxx").Result <> "AAA"

--
Cheers
macropod
[MVP - Microsoft Word]


C''''est_moi said:
Again, in dire need of help. I need to have a sentence disappear if the
result of two different DD (each with 10 choices in them) is NOT equal to
something (both results are the same, below "AAA").

If ActiveDocument.FormFields("xxx").Result = "AAA" Or
ActiveDocument.FormFields("yyy") = "AAA" then

That is the command that I came up with and which works perfectly fine in
erasing my sentence but I want the contrary. I tried adding

= false

at the end but that does not work either. And I cannot find any "is not
equal to" command.

Merci/Thank you for any help anyone can provide.

Carmen
 
C

C''''est_moi

Well, MacroPod you are a genius b/c this "<>" works perfectly fine and is
kinda more elegant. Yet another beautiful thing that I have learned and that
will be very very useful. I do have another question though but I will post
it through the regular channel in the hope that you will look at it and maybe
come up with the answer. Thx a million for your help.
--
Merci/Thank you.


macropod said:
Hi Carmen,

Another approach would be:
If Not ActiveDocument.FormFields("xxx").Result = "AAA"

--
Cheers
macropod
[MVP - Microsoft Word]


macropod said:
Hi,

How about:
If ActiveDocument.FormFields("xxx").Result <> "AAA"

--
Cheers
macropod
[MVP - Microsoft Word]


C''''est_moi said:
Again, in dire need of help. I need to have a sentence disappear if the
result of two different DD (each with 10 choices in them) is NOT equal to
something (both results are the same, below "AAA").

If ActiveDocument.FormFields("xxx").Result = "AAA" Or
ActiveDocument.FormFields("yyy") = "AAA" then

That is the command that I came up with and which works perfectly fine in
erasing my sentence but I want the contrary. I tried adding

= false

at the end but that does not work either. And I cannot find any "is not
equal to" command.

Merci/Thank you for any help anyone can provide.

Carmen
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top