Dim currentDate As String = DateTime.Now.ToString(“MM/dd/yyyy”)
Dim currentDateTime As DateTime = Convert.ToDateTime(currentDate)
Dim previousMonthDateTime As DateTime = currentDateTime.AddMonths(-1)
Dim firstDayOfPreviousMonth As New DateTime(previousMonthDateTime.Year, previousMonthDateTime.Month, 1)
Dim formattedDate As String = firstDayOfPreviousMonth.ToString(“MM/dd/yyyy”)
System.Windows.Forms.SendKeys.SendWait(formattedDate)
Above is the code runs well under debug 4x slow speed, but error occurred during normal speed.
This is the error.
Invoke Code: No compiled code to run
error BC30456: ‘SendKeys’ is not a member of ‘System.Windows.Forms’. At line 6
Please advise how to resolve this issue.