Commandbuttom code not working

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?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top