[Solved] Nested IF's / logical operators?

Creating a macro - Writing a Script - Using the API

[Solved] Nested IF's / logical operators?

Postby gurkand » Wed Feb 28, 2018 12:52 pm

Hi All,

Not at home, therefore cannot test it myself, want to prepare the stuff now as it will take some time...

If <condition1> AND <condition2> Then
...
End If

Will this one work, or do I need to code this as the following?

If <condition1> Then
If <condition2> Then
...
End If
End If

Thanks in advance.

Regards,
Last edited by gurkand on Wed Feb 28, 2018 8:13 pm, edited 1 time in total.
Apache OpenOffice 4.1.3
gurkand
 
Posts: 6
Joined: Wed Feb 28, 2018 10:27 am

Re: Nested IF's / logical operators?

Postby FJCC » Wed Feb 28, 2018 3:11 pm

This will work:
Code: Select all   Expand viewCollapse view
If <condition1> AND <condition2> Then
...
End If
AOO 3.4 or 4.1 on MS Windows XP ( before 2013-08-03) or Windows 7
If your question is answered, please go to your first post, select the Edit button, and add [Solved] to the beginning of the title.
FJCC
Moderator
 
Posts: 6518
Joined: Sat Nov 08, 2008 8:08 pm
Location: Colorado, USA

Re: Nested IF's / logical operators?

Postby JeJe » Wed Feb 28, 2018 4:33 pm

It can help clarity to use brackets.

Code: Select all   Expand viewCollapse view
If (<condition1> AND <condition2>) Then
Openoffice 4.1.2
Windows 8
JeJe
 
Posts: 223
Joined: Wed Mar 09, 2016 2:40 pm


Return to Macros and UNO API

Who is online

Users browsing this forum: No registered users and 8 guests