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