PC Review
Forums
Newsgroups
Microsoft Outlook
Microsoft Outlook Form Programming
Event handling on Custom Forms with simple controls
Forums
Newsgroups
Microsoft Outlook
Microsoft Outlook Form Programming
Event handling on Custom Forms with simple controls
![]() |
Event handling on Custom Forms with simple controls |
|
|
Thread Tools | Rate Thread |
|
|
#1 |
|
Guest
Posts: n/a
|
Hi I'm new to Outlook programming. I'm working on a custom Outlook 2003 Form.
I have added textbox controls to Form but can't get the control to do anything useful. I want to link some code to the control, but in the VBA project the controls aren't included. Also how can I tell if i'm writting a macro (script -VBA?) or sub routines (native VB?) and how do i link them to a control or event other than Outlook application events? Basically I only want the functionality when the form (email msg class) executes not whenever Outlook launches. Also I've been asked to update a sharepoint calander via this forms input is that possible? All suggestion welcome Cheers |
|
|
|
#2 |
|
Guest
Posts: n/a
|
Code behind an Outlook custom form is VBScript and is added through the form design code window.
A text box fires no events. Also note that custom message forms are often a bad idea. What is it that you're trying to accomplish? The article at http://msdn.microsoft.com/library/e...WhatsNew2k3.asp shows how to write to a SharePoint contacts list. Writing to an events list would be similar. -- Sue Mosher, Outlook MVP Author of Configuring Microsoft Outlook 2003 http://www.turtleflock.com/olconfig/index.htm and Microsoft Outlook Programming - Jumpstart for Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx "A Reno" <A Reno@discussions.microsoft.com> wrote in message news:524A4F32-BBFE-4ED4-B2B5-582877E49ADB@microsoft.com... > Hi I'm new to Outlook programming. I'm working on a custom Outlook 2003 Form. > I have added textbox controls to Form but can't get the control to do > anything useful. I want to link some code to the control, but in the VBA > project the controls aren't included. Also how can I tell if i'm writting a > macro (script -VBA?) or sub routines (native VB?) and how do i link them to > a control or event other than Outlook application events? Basically I only > want the functionality when the form (email msg class) executes not whenever > Outlook launches. > > Also I've been asked to update a sharepoint calander via this forms input is > that possible? > > All suggestion welcome > > Cheers |
|
|
|
#3 |
|
Guest
Posts: n/a
|
Thanks for your reply Sue! I am trying to develop a Form with dates for
staff's Holiday, so staff can download the form from our Intranet, fill out the form, then vb code validates the data then sends the mail to the recipient, then on vote approval adds the dates to the company' s holiday calendar. A vote option confirms yes or no and a reply is emailed. My custom form object isn't shown in the IDE. Project1 is the root node, then there's an Outlooksession, then a node called Module1. If I add a form in the IDE then everything is as expected for that form object, but it’s not linked to the parent. the two entities (VB IDE) and my form aren't connected. I want to work on the custom form object's controls - i.e a textbox in the IDE. Not the Outlook Program. The textbox doesn’t exist, nor does my form. To make things more strange when I choose Tools -> view code I can write script in there. How comes I can't see or edit this in the IDE? Why is the program raising an "object required" exception, when executing the TextBox10.Text statement? TextBox10 is on the damn form! Sub CommandButton1_Click() Set Word = Application.CreateObject("Word.Application") Word.Visible = True Word.Documents.Open ("C:\a.doc") TxtBoxCheck() End Sub sub TxtBoxCheck() TextBox10.Text = "balls" end sub Good news we are finishing early to work the England game. All answers welcome! "Sue Mosher [MVP-Outlook]" wrote: > Code behind an Outlook custom form is VBScript and is added through the form design code window. > > A text box fires no events. Also note that custom message forms are often a bad idea. What is it that you're trying to accomplish? > > The article at http://msdn.microsoft.com/library/e...WhatsNew2k3.asp shows how to write to a SharePoint contacts list. Writing to an events list would be similar. > -- > Sue Mosher, Outlook MVP > Author of Configuring Microsoft Outlook 2003 > http://www.turtleflock.com/olconfig/index.htm > and Microsoft Outlook Programming - Jumpstart for > Administrators, Power Users, and Developers > http://www.outlookcode.com/jumpstart.aspx > > "A Reno" <A Reno@discussions.microsoft.com> wrote in message news:524A4F32-BBFE-4ED4-B2B5-582877E49ADB@microsoft.com... > > Hi I'm new to Outlook programming. I'm working on a custom Outlook 2003 Form. > > I have added textbox controls to Form but can't get the control to do > > anything useful. I want to link some code to the control, but in the VBA > > project the controls aren't included. Also how can I tell if i'm writting a > > macro (script -VBA?) or sub routines (native VB?) and how do i link them to > > a control or event other than Outlook application events? Basically I only > > want the functionality when the form (email msg class) executes not whenever > > Outlook launches. > > > > Also I've been asked to update a sharepoint calander via this forms input is > > that possible? > > > > All suggestion welcome > > > > Cheers > |
|
|
|
#4 |
|
Guest
Posts: n/a
|
>> so staff can download the form from our Intranet, fill out
>> the form, then vb code validates the data Are you using Exchange as your mail server? Do you have permission to publish the form to the Organizational Forms library? If the answer to both question is not Yes, you're going to have a very difficult time getting an Outlook message form with code behind it to work. > My custom form object isn't shown in the IDE That's to be expected. As I said, custom form code is VBScript entered in the Outlook form designer's code window. It has nothing at all to do with the VBA IDE (although many of us use VBA to prototype code for eventual porting to VBScript). In general, you will refer to custom form controls only when you want to change the look of those controls or handle a Click event. The data is stored in Outlook properties and you should refer to those properties directly, using the syntax described at http://www.outlookcode.com/d/propsyntax.htm Enjoy the game! -- Sue Mosher, Outlook MVP Author of Configuring Microsoft Outlook 2003 http://www.turtleflock.com/olconfig/index.htm and Microsoft Outlook Programming - Jumpstart for Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx "A Reno" <AReno@discussions.microsoft.com> wrote in message news:8F1BEA0C-F7EC-48DC-A1B7-2EE1B3B8D67B@microsoft.com... > Thanks for your reply Sue! I am trying to develop a Form with dates for > staff's Holiday, so staff can download the form from our Intranet, fill out > the form, then vb code validates the data then sends the mail to the > recipient, then on vote approval adds the dates to the company' s holiday > calendar. A vote option confirms yes or no and a reply is emailed. > > My custom form object isn't shown in the IDE. Project1 is the root node, > then there's an Outlooksession, then a node called Module1. If I add a form > in the IDE then everything is as expected for that form object, but it’s not > linked to the parent. the two entities (VB IDE) and my form aren't connected. > I want to work on the custom form object's controls - i.e a textbox in the > IDE. Not the Outlook Program. The textbox doesn’t exist, nor does my form. To > make things more strange when I choose Tools -> view code I can write script > in there. How comes I can't see or edit this in the IDE? > > Why is the program raising an "object required" exception, when executing > the TextBox10.Text statement? TextBox10 is on the damn form! > > Sub CommandButton1_Click() > Set Word = Application.CreateObject("Word.Application") > Word.Visible = True > Word.Documents.Open ("C:\a.doc") > TxtBoxCheck() > End Sub > > sub TxtBoxCheck() > TextBox10.Text = "balls" > end sub > > Good news we are finishing early to work the England game. > > All answers welcome! > > "Sue Mosher [MVP-Outlook]" wrote: > >> Code behind an Outlook custom form is VBScript and is added through the form design code window. >> >> A text box fires no events. Also note that custom message forms are often a bad idea. What is it that you're trying to accomplish? >> >> The article at http://msdn.microsoft.com/library/e...WhatsNew2k3.asp shows how to write to a SharePoint contacts list. Writing to an events list would be similar. >> >> "A Reno" <A Reno@discussions.microsoft.com> wrote in message news:524A4F32-BBFE-4ED4-B2B5-582877E49ADB@microsoft.com... >> > Hi I'm new to Outlook programming. I'm working on a custom Outlook 2003 Form. >> > I have added textbox controls to Form but can't get the control to do >> > anything useful. I want to link some code to the control, but in the VBA >> > project the controls aren't included. Also how can I tell if i'm writting a >> > macro (script -VBA?) or sub routines (native VB?) and how do i link them to >> > a control or event other than Outlook application events? Basically I only >> > want the functionality when the form (email msg class) executes not whenever >> > Outlook launches. >> > >> > Also I've been asked to update a sharepoint calander via this forms input is >> > that possible? >> > >> > All suggestion welcome >> > >> > Cheers >> |
|
|
|
#5 |
|
Guest
Posts: n/a
|
Yes, I am running an exchange server, but didn't anticipate I would need to
publish forms in particular locatation. Thanks for the info. Is there a major limit to what can be addressed? For example its possible to add a command button event and script which can't change the name of the caption on the command button because the object can't be resolved. Which explains why the textbox can't do anything useful either? (see below) ------------------------------------------------------------------------------------------------- "Sue Mosher [MVP-Outlook]" wrote: > >> so staff can download the form from our Intranet, fill out > >> the form, then vb code validates the data > > Are you using Exchange as your mail server? Do you have permission to publish the form to the Organizational Forms library? If the answer to both question is not Yes, you're going to have a very difficult time getting an Outlook message form with code behind it to work. > > > My custom form object isn't shown in the IDE > > That's to be expected. As I said, custom form code is VBScript entered in the Outlook form designer's code window. It has nothing at all to do with the VBA IDE (although many of us use VBA to prototype code for eventual porting to VBScript). > > In general, you will refer to custom form controls only when you want to change the look of those controls or handle a Click event. The data is stored in Outlook properties and you should refer to those properties directly, using the syntax described at http://www.outlookcode.com/d/propsyntax.htm > > Enjoy the game! > -- > Sue Mosher, Outlook MVP > Author of Configuring Microsoft Outlook 2003 > http://www.turtleflock.com/olconfig/index.htm > and Microsoft Outlook Programming - Jumpstart for > Administrators, Power Users, and Developers > http://www.outlookcode.com/jumpstart.aspx > > "A Reno" <AReno@discussions.microsoft.com> wrote in message news:8F1BEA0C-F7EC-48DC-A1B7-2EE1B3B8D67B@microsoft.com... > > Thanks for your reply Sue! I am trying to develop a Form with dates for > > staff's Holiday, so staff can download the form from our Intranet, fill out > > the form, then vb code validates the data then sends the mail to the > > recipient, then on vote approval adds the dates to the company' s holiday > > calendar. A vote option confirms yes or no and a reply is emailed. > > > > My custom form object isn't shown in the IDE. Project1 is the root node, > > then there's an Outlooksession, then a node called Module1. If I add a form > > in the IDE then everything is as expected for that form object, but it’s not > > linked to the parent. the two entities (VB IDE) and my form aren't connected. > > I want to work on the custom form object's controls - i.e a textbox in the > > IDE. Not the Outlook Program. The textbox doesn’t exist, nor does my form. To > > make things more strange when I choose Tools -> view code I can write script > > in there. How comes I can't see or edit this in the IDE? > > > > Why is the program raising an "object required" exception, when executing > > the TextBox10.Text statement? TextBox10 is on the damn form! > > > > Sub CommandButton1_Click() > > Set Word = Application.CreateObject("Word.Application") > > Word.Visible = True > > Word.Documents.Open ("C:\a.doc") > > TxtBoxCheck() > > End Sub > > > > sub TxtBoxCheck() > > TextBox10.Text = "balls" > > end sub > > > > Good news we are finishing early to work the England game. > > > > All answers welcome! > > > > "Sue Mosher [MVP-Outlook]" wrote: > > > >> Code behind an Outlook custom form is VBScript and is added through the form design code window. > >> > >> A text box fires no events. Also note that custom message forms are often a bad idea. What is it that you're trying to accomplish? > >> > >> The article at http://msdn.microsoft.com/library/e...WhatsNew2k3.asp shows how to write to a SharePoint contacts list. Writing to an events list would be similar. > >> > >> "A Reno" <A Reno@discussions.microsoft.com> wrote in message news:524A4F32-BBFE-4ED4-B2B5-582877E49ADB@microsoft.com... > >> > Hi I'm new to Outlook programming. I'm working on a custom Outlook 2003 Form. > >> > I have added textbox controls to Form but can't get the control to do > >> > anything useful. I want to link some code to the control, but in the VBA > >> > project the controls aren't included. Also how can I tell if i'm writting a > >> > macro (script -VBA?) or sub routines (native VB?) and how do i link them to > >> > a control or event other than Outlook application events? Basically I only > >> > want the functionality when the form (email msg class) executes not whenever > >> > Outlook launches. > >> > > >> > Also I've been asked to update a sharepoint calander via this forms input is > >> > that possible? > >> > > >> > All suggestion welcome > >> > > >> > Cheers > >> > |
|
|
|
#6 |
|
Guest
Posts: n/a
|
> its possible to
> add a command button event and script which can't change the name of the > caption on the command button because the object can't be resolved Did you look at the page I suggested?This will give you the correct syntax for returning a control on an Outlook custom form. It is not the same as the VBA user form syntax. -- Sue Mosher, Outlook MVP Author of Configuring Microsoft Outlook 2003 http://www.turtleflock.com/olconfig/index.htm and Microsoft Outlook Programming - Jumpstart for Administrators, Power Users, and Developers http://www.outlookcode.com/jumpstart.aspx "A Reno" <AReno@discussions.microsoft.com> wrote in message news:F36C6A57-AFD8-4415-BB9F-AFC95E457818@microsoft.com... > Yes, I am running an exchange server, but didn't anticipate I would need to > publish forms in particular locatation. > > Thanks for the info. > > Is there a major limit to what can be addressed? For example its possible to > add a command button event and script which can't change the name of the > caption on the command button because the object can't be resolved. Which > explains why the textbox can't do anything useful either? (see below) > > ------------------------------------------------------------------------------------------------- > > > "Sue Mosher [MVP-Outlook]" wrote: > >> >> so staff can download the form from our Intranet, fill out >> >> the form, then vb code validates the data >> >> Are you using Exchange as your mail server? Do you have permission to publish the form to the Organizational Forms library? If the answer to both question is not Yes, you're going to have a very difficult time getting an Outlook message form with code behind it to work. >> >> > My custom form object isn't shown in the IDE >> >> That's to be expected. As I said, custom form code is VBScript entered in the Outlook form designer's code window. It has nothing at all to do with the VBA IDE (although many of us use VBA to prototype code for eventual porting to VBScript). >> >> In general, you will refer to custom form controls only when you want to change the look of those controls or handle a Click event. The data is stored in Outlook properties and you should refer to those properties directly, using the syntax described at http://www.outlookcode.com/d/propsyntax.htm >> >> >> "A Reno" <AReno@discussions.microsoft.com> wrote in message news:8F1BEA0C-F7EC-48DC-A1B7-2EE1B3B8D67B@microsoft.com... >> > Thanks for your reply Sue! I am trying to develop a Form with dates for >> > staff's Holiday, so staff can download the form from our Intranet, fill out >> > the form, then vb code validates the data then sends the mail to the >> > recipient, then on vote approval adds the dates to the company' s holiday >> > calendar. A vote option confirms yes or no and a reply is emailed. >> > >> > My custom form object isn't shown in the IDE. Project1 is the root node, >> > then there's an Outlooksession, then a node called Module1. If I add a form >> > in the IDE then everything is as expected for that form object, but it’s not >> > linked to the parent. the two entities (VB IDE) and my form aren't connected. >> > I want to work on the custom form object's controls - i.e a textbox in the >> > IDE. Not the Outlook Program. The textbox doesn’t exist, nor does my form. To >> > make things more strange when I choose Tools -> view code I can write script >> > in there. How comes I can't see or edit this in the IDE? >> > >> > Why is the program raising an "object required" exception, when executing >> > the TextBox10.Text statement? TextBox10 is on the damn form! >> > >> > Sub CommandButton1_Click() >> > Set Word = Application.CreateObject("Word.Application") >> > Word.Visible = True >> > Word.Documents.Open ("C:\a.doc") >> > TxtBoxCheck() >> > End Sub >> > >> > sub TxtBoxCheck() >> > TextBox10.Text = "balls" >> > end sub >> > >> > Good news we are finishing early to work the England game. >> > >> > All answers welcome! >> > >> > "Sue Mosher [MVP-Outlook]" wrote: >> > >> >> Code behind an Outlook custom form is VBScript and is added through the form design code window. >> >> >> >> A text box fires no events. Also note that custom message forms are often a bad idea. What is it that you're trying to accomplish? >> >> >> >> The article at http://msdn.microsoft.com/library/e...WhatsNew2k3.asp shows how to write to a SharePoint contacts list. Writing to an events list would be similar. >> >> >> >> "A Reno" <A Reno@discussions.microsoft.com> wrote in message news:524A4F32-BBFE-4ED4-B2B5-582877E49ADB@microsoft.com... >> >> > Hi I'm new to Outlook programming. I'm working on a custom Outlook 2003 Form. >> >> > I have added textbox controls to Form but can't get the control to do >> >> > anything useful. I want to link some code to the control, but in the VBA >> >> > project the controls aren't included. Also how can I tell if i'm writting a >> >> > macro (script -VBA?) or sub routines (native VB?) and how do i link them to >> >> > a control or event other than Outlook application events? Basically I only >> >> > want the functionality when the form (email msg class) executes not whenever >> >> > Outlook launches. >> >> > >> >> > Also I've been asked to update a sharepoint calander via this forms input is >> >> > that possible? >> >> > >> >> > All suggestion welcome >> >> > >> >> > Cheers >> >> >> |
|
|
|
#7 |
|
Guest
Posts: n/a
|
Excellent, thanks for the useful reference links Sue!
"Sue Mosher [MVP-Outlook]" wrote: > > its possible to > > add a command button event and script which can't change the name of the > > caption on the command button because the object can't be resolved > > Did you look at the page I suggested?This will give you the correct syntax for returning a control on an Outlook custom form. It is not the same as the VBA user form syntax. > > -- > Sue Mosher, Outlook MVP > Author of Configuring Microsoft Outlook 2003 > http://www.turtleflock.com/olconfig/index.htm > and Microsoft Outlook Programming - Jumpstart for > Administrators, Power Users, and Developers > http://www.outlookcode.com/jumpstart.aspx > > "A Reno" <AReno@discussions.microsoft.com> wrote in message news:F36C6A57-AFD8-4415-BB9F-AFC95E457818@microsoft.com... > > Yes, I am running an exchange server, but didn't anticipate I would need to > > publish forms in particular locatation. > > > > Thanks for the info. > > > > Is there a major limit to what can be addressed? For example its possible to > > add a command button event and script which can't change the name of the > > caption on the command button because the object can't be resolved. Which > > explains why the textbox can't do anything useful either? (see below) > > > > ------------------------------------------------------------------------------------------------- > > > > > > "Sue Mosher [MVP-Outlook]" wrote: > > > >> >> so staff can download the form from our Intranet, fill out > >> >> the form, then vb code validates the data > >> > >> Are you using Exchange as your mail server? Do you have permission to publish the form to the Organizational Forms library? If the answer to both question is not Yes, you're going to have a very difficult time getting an Outlook message form with code behind it to work. > >> > >> > My custom form object isn't shown in the IDE > >> > >> That's to be expected. As I said, custom form code is VBScript entered in the Outlook form designer's code window. It has nothing at all to do with the VBA IDE (although many of us use VBA to prototype code for eventual porting to VBScript). > >> > >> In general, you will refer to custom form controls only when you want to change the look of those controls or handle a Click event. The data is stored in Outlook properties and you should refer to those properties directly, using the syntax described at http://www.outlookcode.com/d/propsyntax.htm > >> > > >> > >> "A Reno" <AReno@discussions.microsoft.com> wrote in message news:8F1BEA0C-F7EC-48DC-A1B7-2EE1B3B8D67B@microsoft.com... > >> > Thanks for your reply Sue! I am trying to develop a Form with dates for > >> > staff's Holiday, so staff can download the form from our Intranet, fill out > >> > the form, then vb code validates the data then sends the mail to the > >> > recipient, then on vote approval adds the dates to the company' s holiday > >> > calendar. A vote option confirms yes or no and a reply is emailed. > >> > > >> > My custom form object isn't shown in the IDE. Project1 is the root node, > >> > then there's an Outlooksession, then a node called Module1. If I add a form > >> > in the IDE then everything is as expected for that form object, but it’s not > >> > linked to the parent. the two entities (VB IDE) and my form aren't connected. > >> > I want to work on the custom form object's controls - i.e a textbox in the > >> > IDE. Not the Outlook Program. The textbox doesn’t exist, nor does my form. To > >> > make things more strange when I choose Tools -> view code I can write script > >> > in there. How comes I can't see or edit this in the IDE? > >> > > >> > Why is the program raising an "object required" exception, when executing > >> > the TextBox10.Text statement? TextBox10 is on the damn form! > >> > > >> > Sub CommandButton1_Click() > >> > Set Word = Application.CreateObject("Word.Application") > >> > Word.Visible = True > >> > Word.Documents.Open ("C:\a.doc") > >> > TxtBoxCheck() > >> > End Sub > >> > > >> > sub TxtBoxCheck() > >> > TextBox10.Text = "balls" > >> > end sub > >> > > >> > Good news we are finishing early to work the England game. > >> > > >> > All answers welcome! > >> > > >> > "Sue Mosher [MVP-Outlook]" wrote: > >> > > >> >> Code behind an Outlook custom form is VBScript and is added through the form design code window. > >> >> > >> >> A text box fires no events. Also note that custom message forms are often a bad idea. What is it that you're trying to accomplish? > >> >> > >> >> The article at http://msdn.microsoft.com/library/e...WhatsNew2k3.asp shows how to write to a SharePoint contacts list. Writing to an events list would be similar. > >> >> > >> >> "A Reno" <A Reno@discussions.microsoft.com> wrote in message news:524A4F32-BBFE-4ED4-B2B5-582877E49ADB@microsoft.com... > >> >> > Hi I'm new to Outlook programming. I'm working on a custom Outlook 2003 Form. > >> >> > I have added textbox controls to Form but can't get the control to do > >> >> > anything useful. I want to link some code to the control, but in the VBA > >> >> > project the controls aren't included. Also how can I tell if i'm writting a > >> >> > macro (script -VBA?) or sub routines (native VB?) and how do i link them to > >> >> > a control or event other than Outlook application events? Basically I only > >> >> > want the functionality when the form (email msg class) executes not whenever > >> >> > Outlook launches. > >> >> > > >> >> > Also I've been asked to update a sharepoint calander via this forms input is > >> >> > that possible? > >> >> > > >> >> > All suggestion welcome > >> >> > > >> >> > Cheers > >> >> > >> > |
|
![]() |
|
| Thread Tools | |
| Rate This Thread | |
|
|

Main Page 

