Code is erroring out at Dim olmail as Outlook.MailItem.
says usertype not defined.... but that is where I am defining it.
fyi running it from excel 2016
short version of what is happening
I'm using this in an older version on the workbook I'm working with. The sub used to be private now it's standard. Tried modifying it either way doesn't change the error.
Another developer made some userform changes and other changes in the workbook... not sure what they are and plugged in old code into the same command button as old version.
I've checked name... etc... , but it errors here where it didn't error on old version...?
I appreciate any help hopefully it just jumps right out at someone. :)
Dim abc As String
Dim emailbody As String
Dim outlookOBJ As Object
' Dim mItem As Object
Dim myPath As Variant
'Dim olmail As Object ' when changing to an object it works, but can't open the file and attachment doesn't attach
Dim olmail As Outlook.MailItem ' errors here User-defined Type not defined, but I am defining it here...?
Set outlookOBJ = CreateObject("Outlook.Application")
' Set olmail = outlookOBJ.CreateItem(0)
Set olmail = outlookOBJ.CreateItem(olMailItem)
Dim strPrompt As String, strname As String
Dim sreplace As String, mychar As Variant, strdate As String
olmail.To = "email@example.com"