Question about:" VisualBasicValue<Boolean>: Object reference not set to an instance of an object

I am trying to make an RPA where it saves an email attachment and if there is no attachment it will just save the email. Does anyone know why I keep getting the error listed in the topic name? I have provided screenshots of the flowchart, code for the flow decision and my variables.


these are the other pictures

forum3

Hi,

Can you try as the following?

RemmitStateents isnot Nothing AndAlso RemmitStatements.Attachments isnot Nothig AndAlso RemmitStateents.Attachments.Any

Regards

That error means RemmitStatements was not initialized, so .Attachments doesn’t exist.

Put into the Default for that variable: New System.Net.MailMessage

For your workflow decision I recommend using RemmitStatements.Attachments.Count > 0

Also, your True/False is backwards. You have it going to “save outlook mail message” if there is an attachment, and it’s going to “save attachments” if there aren’t any attachments.

that worked, thank you for the help

1 Like

this helped a lot, thank you so much