Distributing outlook code

J

John

Hi

I have a very simple piece of vba code in outlook as below which references
DAO 3.6 and Outlook 12 Object Library. My questions are;

1. How can I distribute this code? Is it possible to make some sort of setup
that end users can run to automatically install this code in their outlooks?

2. Will the code work on OL2000 and upwards without any change?

Thanks

Regards




Code Follows
=========

Option Explicit
Private Sub Application_ItemSend(ByVal Item As Object, Cancel As Boolean)
Dim St As String
Dim EmailItem
Dim db As DAO.Database
Dim ws As DAO.Workspace
Dim rst As DAO.Recordset
Dim Subject As String
Dim Company_ID As String

Set EmailItem = Item

Company_ID = EmailItem.UserProperties.Item("CompanyID").Value
Subject = EmailItem.Subject

St = " SELECT """ & Subject & """ as Subject, """ & Company_ID & """ as ID
INTO MyTable"

Set ws = DBEngine.Workspaces(0)
Set db = ws.OpenDatabase("C:\db1.mdb")

db.Execute (St)
End Sub
 

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