PC Review
Forums
Newsgroups
Microsoft Outlook
Microsoft Outlook Form Programming
CommandButton click won't fire on form?
Forums
Newsgroups
Microsoft Outlook
Microsoft Outlook Form Programming
CommandButton click won't fire on form?
![]() |
CommandButton click won't fire on form? |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
Hi,
I have a custom outlook 2002 form with a CommandButton1. In the "View Code" option I added the following and selected "Run this form". When the form shows up in my inbox the click event won't fire. Sub CommandButton1_Click() MsgBox "Hello" End Sub Eventually I want this to send an email but I wanted to test it first... Sub CommandButton2_Click() Dim Outlook Set Outlook = CreateObject("Outlook.Application") Dim Email Email = Outlook.CreateItem(olMailItem) With Email .Subject = "test.." .Body = "body text..." .To = "myemail@somewhere.com" .Send End With Outlook.Quit Set Outlook = Nothing End Sub |
|
|
|
#2 |
|
Guest
Posts: n/a
|
If the form runs code when you use Run This Form in design mode, but doesn't
run code after you have sent or saved an item using the form, you probably have done something to "one-off" the form. Outlook 2003, Outlook 2002, Outlook 2000 SP2 and Outlook 2000 or 98 with the Email Security Update will not run code on one-off forms; see http://www.outlookcode.com/d/secforms.htm for more information on this issue. To ensure that a form does not one-off: -- Make sure the "Send form definition with item" box on the (Properties) tab of the form is *not* checked. [1] -- For in-house corporate use with Exchange Server, publish the form to the Organization Forms library or a public folder's forms library, as appropriate for your application. -- For collaboration via the Internet, publish your form to your Personal Forms library. Save it as an .oft file and send it to other people who need to use it with instructions to publish it with the same form name that you used. Many other things can cause one-off forms. If the above steps don't work on a new item created with your form, see http://www.slipstick.com/dev/formpub.htm#oneoff for other possible causes. [1] Whenever you publish a message form, Outlook will suggest that you may want to check the "Send form definition with item" box to ensure that the recipient will have the form, especially if you're sending to someone via the Internet. In the current Outlook security environment, this suggestion is obsolete. Ignore it unless your form has no code behind it. Also note that you do not need to create an Outlook.Application object. Form code supports an intrinsic Application object. -- Sue Mosher, Outlook MVP Author of Microsoft Outlook Programming - Jumpstart for Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx "Dave" <anonymous@discussions.microsoft.com> wrote in message news:022c01c48c71$b5ffa680$a401280a@phx.gbl... > Hi, > > I have a custom outlook 2002 form with a CommandButton1. > > In the "View Code" option I added the following and > selected "Run this form". When the form shows up in my > inbox the click event won't fire. > > Sub CommandButton1_Click() > MsgBox "Hello" > End Sub > > Eventually I want this to send an email but I wanted to > test it first... > > Sub CommandButton2_Click() > Dim Outlook > Set Outlook = CreateObject("Outlook.Application") > Dim Email > Email = Outlook.CreateItem(olMailItem) > > With Email > .Subject = "test.." > .Body = "body text..." > .To = "myemail@somewhere.com" > .Send > End With > > Outlook.Quit > Set Outlook = Nothing > End Sub |
|
|
|
#3 |
|
Guest
Posts: n/a
|
If you cannot publish to Org Forms and you need code to run, you have only
one option -- have each user publish the message form to their own Personal Forms library. -- Sue Mosher, Outlook MVP Author of Microsoft Outlook Programming - Jumpstart for Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx "Dave" <Dave@discussions.microsoft.com> wrote in message news:2B71C5E4-8E85-4FB8-A4D2-27C014E9E38F@microsoft.com... >I forgot to add this is in-house (intranet) and we were getting some push > back publishing to Organizational lib. so I don't know what my options > are.... > > "Dave" wrote: > >> Sue, >> >> Thanks. One follow-up though, I got the script to run when I UN-check >> the >> "Send form definition" option. But if I cc the form to my team member, >> she >> doesn't see the "Read Page" (survey form) I want users to fill out. Only >> I >> see it. She just sees the "Compose Page". >> >> But, if check ON the "Send form definition", and cc her again, she gets >> the >> survey form but then the CommandButton's script doesn't work. >> >> BTW, I'm publishing this to my personal forms libraray. Is my only >> option >> to publish to the Organizational forms lib? I don't get what is >> happening. >> >> Thanks again. Dave >> >> "Sue Mosher [MVP-Outlook]" wrote: >> >> > If the form runs code when you use Run This Form in design mode, but >> > doesn't >> > run code after you have sent or saved an item using the form, you >> > probably >> > have done something to "one-off" the form. Outlook 2003, Outlook 2002, >> > Outlook 2000 SP2 and Outlook 2000 or 98 with the Email Security Update >> > will >> > not run code on one-off forms; see >> > http://www.outlookcode.com/d/secforms.htm >> > for more information on this issue. >> > >> > To ensure that a form does not one-off: >> > >> > -- Make sure the "Send form definition with item" box on the >> > (Properties) >> > tab of the form is *not* checked. [1] >> > >> > -- For in-house corporate use with Exchange Server, publish the form to >> > the >> > Organization Forms library or a public folder's forms library, as >> > appropriate for your application. >> > >> > -- For collaboration via the Internet, publish your form to your >> > Personal >> > Forms library. Save it as an .oft file and send it to other people who >> > need >> > to use it with instructions to publish it with the same form name that >> > you >> > used. >> > >> > Many other things can cause one-off forms. If the above steps don't >> > work on >> > a new item created with your form, see >> > http://www.slipstick.com/dev/formpub.htm#oneoff for other possible >> > causes. >> > >> > [1] Whenever you publish a message form, Outlook will suggest that you >> > may >> > want to check the "Send form definition with item" box to ensure that >> > the >> > recipient will have the form, especially if you're sending to someone >> > via >> > the Internet. In the current Outlook security environment, this >> > suggestion >> > is obsolete. Ignore it unless your form has no code behind it. >> > >> > >> > "Dave" <anonymous@discussions.microsoft.com> wrote in message >> > news:022c01c48c71$b5ffa680$a401280a@phx.gbl... >> > > Hi, >> > > >> > > I have a custom outlook 2002 form with a CommandButton1. >> > > >> > > In the "View Code" option I added the following and >> > > selected "Run this form". When the form shows up in my >> > > inbox the click event won't fire. >> > > >> > > Sub CommandButton1_Click() >> > > MsgBox "Hello" >> > > End Sub >> > > >> > > Eventually I want this to send an email but I wanted to >> > > test it first... >> > > >> > > Sub CommandButton2_Click() >> > > Dim Outlook >> > > Set Outlook = CreateObject("Outlook.Application") >> > > Dim Email >> > > Email = Outlook.CreateItem(olMailItem) >> > > >> > > With Email >> > > .Subject = "test.." >> > > .Body = "body text..." >> > > .To = "myemail@somewhere.com" >> > > .Send >> > > End With >> > > >> > > Outlook.Quit >> > > Set Outlook = Nothing >> > > End Sub >> > >> > >> > |
|
|
|
#4 |
|
Guest
Posts: n/a
|
No. Think about it: How would Outlook know to look in that particular public
folder for a message form? -- Sue Mosher, Outlook MVP Author of Microsoft Outlook Programming - Jumpstart for Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx "Dave" <Dave@discussions.microsoft.com> wrote in message news:FEC43515-D9C4-42A5-8871-EAF8EF47D1BB@microsoft.com... > Sue, > > I may be able to get a Public Folder created by my admin. Would this work > the same as an Org. Folder? > > "Sue Mosher [MVP-Outlook]" wrote: > >> If you cannot publish to Org Forms and you need code to run, you have >> only >> one option -- have each user publish the message form to their own >> Personal >> Forms library. >> >> >> "Dave" <Dave@discussions.microsoft.com> wrote in message >> news:2B71C5E4-8E85-4FB8-A4D2-27C014E9E38F@microsoft.com... >> >I forgot to add this is in-house (intranet) and we were getting some >> >push >> > back publishing to Organizational lib. so I don't know what my options >> > are.... >> > |
|
|
|
#5 |
|
Guest
Posts: n/a
|
Sorry, I guess I don't know. Can I just tell the user to look in a public
folder for the survey once I publish it there? This is all new to me and I'm trying to figure out a method that will work. In our company we are not allowed to have forms published to the Org. Folder. I just wanted to know if a Public Folder will be a better solution than having users manually publish the survey form to their personal forms library. I guess I want to fully understand this first since I have to submit a formal request to get this public folder created. In my book, having the users do less is always a better solution to eliminate support issues. Thanks, Dave "Sue Mosher [MVP-Outlook]" wrote: > No. Think about it: How would Outlook know to look in that particular public > folder for a message form? > > -- > Sue Mosher, Outlook MVP > Author of > Microsoft Outlook Programming - Jumpstart for > Administrators, Power Users, and Developers > http://www.outlookcode.com/jumpstart.aspx > > > "Dave" <Dave@discussions.microsoft.com> wrote in message > news:FEC43515-D9C4-42A5-8871-EAF8EF47D1BB@microsoft.com... > > Sue, > > > > I may be able to get a Public Folder created by my admin. Would this work > > the same as an Org. Folder? > > > > "Sue Mosher [MVP-Outlook]" wrote: > > > >> If you cannot publish to Org Forms and you need code to run, you have > >> only > >> one option -- have each user publish the message form to their own > >> Personal > >> Forms library. > >> > >> > >> "Dave" <Dave@discussions.microsoft.com> wrote in message > >> news:2B71C5E4-8E85-4FB8-A4D2-27C014E9E38F@microsoft.com... > >> >I forgot to add this is in-house (intranet) and we were getting some > >> >push > >> > back publishing to Organizational lib. so I don't know what my options > >> > are.... > >> > > > > |
|
|
|
#6 |
|
Guest
Posts: n/a
|
> Can I just tell the user to look in a public
> folder for the survey once I publish it there? That might work -- if you also have the survey form published in the Inbox or Personal Forms library of the people who will be reading the survey results. > In our company we are not allowed to have forms published to the Org. > Folder. I just wanted to know if a Public Folder will be a better > solution > than having users manually publish the survey form to their personal forms > library. > I guess I want to fully understand this first since I have to submit a > formal request to get this public folder created. You might want to read up on form library and cache issues at http://www.outlookcode.com/d/formpub.htm and http://www.outlookcode.com/d/formscache.htm -- Sue Mosher, Outlook MVP Author of Microsoft Outlook Programming - Jumpstart for Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

