Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using vba in Outlook

Status
Not open for further replies.

boein

Technical User
Jul 17, 2003
84
BE
Hi,

How do you assign vba-code to visual basic control-objects (commandbuttons, text-boxes, labels...etc) in Outlook 2003. In Word, Excel access it's quite easy but in outlook I don't see how I can do this, or is it not possible?

regards,
Boein
 
You assign code to them exactly the same way as in Word or Excel. You write the code for the events. What exactly is the problem? Please describe exactly what is not woprking for you.

faq219-2884

Gerry
My paintings and sculpture
 
Hi Gerry,

You're right if you press ALT+F11 it's the same as in Excel, Word. But if you work with outlook forms you also have the vb-controls. When you look at the properties of each object 'view code' is missing. I guess this is something different? My goal is to create an outlook application based on an outlook form, accessing the data linked with that form with vba.

Kind regards
Boein
 
Hi boein,

with Outlook FORMS it is different indeed:
They expect VB Script rather than VBA. You have to treat the forms as you would an ASP page.
;-)

[navy]"We had to turn off that service to comply with the CDA Bill."[/navy]
- The Bastard Operator From Hell
 
Ok thanks for clearing that out for me, nevertheless I still have a question. Is it possible to get data from your outlook form by means of vba code that is put in your outlook form and how do you that. In other words I want to use the outlook form to put in data and retrieving it by vba-code in outlook. Doing this I can use my exchange server as database and share this application to the users to manipulate the database.

Boein

 
Hi Boein,

not sure if this is possible.
You could try with something like this:
Code:
Dim frm As Outlook.FormDescription

If TypeOf ActiveInspector.CurrentItem Is Outlook.FormDescription Then
    Set frm = ActiveInspector.CurrentItem

    ' ...
End If
And then single-step through the code with that form opened.
Perhaps you'll find the proper methods to address your controls in the watch window.

Good luck!

[navy]"We had to turn off that service to comply with the CDA Bill."[/navy]
- The Bastard Operator From Hell
 
That looks very complicated. Maybe it's better to this application in access. Are you sure there's no way to get data from the form. It must be stored in some way right, so it must be possible te read it back.

Kind regards
Boein
 
THAT looks complicated?
[ROTFL]

If all you want to do is collect, store and evaluate data, then, yes, you are definitely better off with a database solution, e.g. in Access.

If you want to use forms as E-Mail template, then Outlook forms would be the way.
But then you should handle the forms in the way Outlook provides - and that is via script, not via VBA.

Cheers,
Andy

[navy]"We had to turn off that service to comply with the CDA Bill."[/navy]
- The Bastard Operator From Hell
 
Hi Andy,

indeed all I want to do is to collect, store and evaluate data. But I would prefer outlook, because the data must be accessible for everybody (multi-user access). Also, everybody uses outlook but not everybody uses access. And a lot of data in the database comes from outlook-exchange for ex. personnel data, e-mailadresses...

Kind regards
Boein
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top