T
tmreyes
i developed a form published to my personal folder that has command button
and the code behind it does not run but when i run the code in VB editor it
works.
Here is the code:
Sub CommandButton1_Click ()
Dim myolApp As Outlook.Application
Dim myinspector As Outlook.Inspector
Dim myItem As Outlook.MailItem
Dim myattachments As Outlook.Attachments
Set myolApp = CreateObject("Outlook.Application")
Set myinspector = myolApp.ActiveInspector
If Not TypeName(myinspector) = "Nothing" Then
Set myItem = myinspector.CurrentItem.Forward
myItem.Recipients.Add "Reyes, Mark M [IT]"
myItem.Send
Else
MsgBox "There is no active inspector."
End If
End Sub
the code is to forward the form to an individual or PDL.
any suggestions as to why the code does not work on the form?
and the code behind it does not run but when i run the code in VB editor it
works.
Here is the code:
Sub CommandButton1_Click ()
Dim myolApp As Outlook.Application
Dim myinspector As Outlook.Inspector
Dim myItem As Outlook.MailItem
Dim myattachments As Outlook.Attachments
Set myolApp = CreateObject("Outlook.Application")
Set myinspector = myolApp.ActiveInspector
If Not TypeName(myinspector) = "Nothing" Then
Set myItem = myinspector.CurrentItem.Forward
myItem.Recipients.Add "Reyes, Mark M [IT]"
myItem.Send
Else
MsgBox "There is no active inspector."
End If
End Sub
the code is to forward the form to an individual or PDL.
any suggestions as to why the code does not work on the form?