I’m trying to create a sequence which checks the content of multiple Word documents in a particular directory for the word ‘Private’. This is how my sequence is constructed at the moment:
- Assign activity: Documents = Directory.GetFiles(“C:\Development\UIPath\Word files”)
- For each activity: item in Documents
- Body: Word application scope activity: Documents.ToString
- Do: Read text activity: DocumentContents
- If condition: DocumentContents.ToString.Contains(“private”)
- Then: Log message activity: Documents.ToString + " includes the word Private"
- Else: Log message activity: Documents.ToString + " does not include the word private"
When I look at the output, all 5 documents show ‘does not include the word private’, even though two of the documents do have the word private. I’m just mucking around but don’t know why this isn’t working, any help appreciated!