Switch (Mon - MM): Index was outside the bounds of the array

Greeting, usually my automation runs perfectly fine these past few days but today this error occur out of nowhere. I read previous solution that need to set the Assign = 0 but I don’t know how to coded it. Appreciate the helps. Screenshot can be refer below:

Page 1:
image

Inside assign:
resultDateSpl = resultDate.Split(CChar(" "))

Pls send screen shot of the switch activity

Hi @DTECH ,
Try to log the resultDateSpl value before the switch and check whether , we are getting the expected value

image

The switch case have resultDateSpl(5) =“1” until resultDateSpl(5) = “12”

Not sure by your meaning but I did put message box. Can take a look.
image

Hi @DTECH
Is this resultDateSpl(5) have values like Jan ,Feb, …Dec and You are trying to overwrite it with 1, 2, 3…
Just wanted to make sure you are passing the correct and necessary variable??

Also try logging the resultDateSpl(5) Just befor switch so that we can ensure we are getting the correct value there

Also u can verify whether there are 6 elements in resultDateSpl by finding the count of the array resultDateSpl.count

I finally figured out after wondering “why mentioning expecting values” out of nowhere but turns out there is one activities getting values from PDF and put into variables. Turns out the activities didn’t get the values from the PDF. (The automation was from other people). Thanks and appreciate.

image

This topic was automatically closed 3 days after the last reply. New replies are no longer allowed.