PC Review


Reply
Thread Tools Rate Thread

Commandbuttom code not working

 
 
tmreyes
Guest
Posts: n/a
 
      11th Feb 2009
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?

--
thanks in advance,
tmreyes
 
Reply With Quote
 
 
 
 
Ken Slovak - [MVP - Outlook]
Guest
Posts: n/a
 
      11th Feb 2009
See the answer in your other thread.

--
Ken Slovak
[MVP - Outlook]
http://www.slovaktech.com
Author: Professional Programming Outlook 2007.
Reminder Manager, Extended Reminders, Attachment Options.
http://www.slovaktech.com/products.htm


"tmreyes" <(E-Mail Removed)> wrote in message
news:08BD63A0-8298-4341-815A-(E-Mail Removed)...
>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?
>
> --
> thanks in advance,
> tmreyes


 
Reply With Quote
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Suddenly the commandbuttom doesn'wort =?Utf-8?B?R2l0dGUgQW5kZXJzZW4=?= Microsoft Access Forms 3 23rd Mar 2006 07:40 AM
Code to simulate mouse click not working - code sample attached John Michl Microsoft Powerpoint 3 19th Oct 2005 03:00 PM
Call a DLL LIB function in ASP.NET (Code Behind) or VB.NET (The same code is working fine in VB 6.0) Peri Microsoft VB .NET 5 20th Jul 2005 06:37 AM
Call a DLL LIB function in ASP.NET (Code Behind) or VB.NET (The same code is working fine in VB 6.0) Peri Microsoft ASP .NET 2 20th Jul 2005 04:13 AM
Add CommandButtom with a hyperlink Rich Microsoft Outlook Form Programming 3 23rd Mar 2004 09:30 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:04 PM.