Event handling on Custom Forms with simple controls

G

Guest

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
 
S

Sue Mosher [MVP-Outlook]

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/en-us/odc_ol2003_ta/html/odc_OLWhatsNew2k3.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

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
G

Guest

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!
 
S

Sue Mosher [MVP-Outlook]

so staff can download the form from our Intranet, fill out
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

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 
G

Guest

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)
 
S

Sue Mosher [MVP-Outlook]

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

and Microsoft Outlook Programming - Jumpstart for
Administrators, Power Users, and Developers
 

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