I created an input request form database using Access 2003 which automatically creates an email using VBA to create the email. This program works fine on all computers using Windows XP but we recently purchased a computer with Windows 7 and on that computer the runtime error Automation error - library not registered occurs. I believe the problem is a DLL file that is missing but have no idea which DLL file. Does anyone have any suggestions on how to fix this problem? I have included the code and where the error occurs for reference:
Private Sub cmdSubmitRequest()
Dim olApp As Outlook.Application
Dim olNS As Outlook.NameSpace
Dim olfolder As Outlook.MAPIFolder
Dim olMailItem As Outlook.MailItem
Dim varBodyText As Variant
Dim strName As String
Dim strDepartment As String
Dim strChargeNumber As String
Dim strRequiredDate As String
Dim strRequestDate As String
Dim strAddtionalInfo As String
Dim strWorkLocation As String
Dim strProductType As String
strName = "Last Name: "
strDepartment = "Department: "
strChargeNumber = "Charge Number: "
strRequiredDate = "Date Wanted: "
strRequestDate = "Date Written: "
strWorkLocation = "Location: "
strProductType = "Product Type: "
strAdditionalInfo = "Description of Work: "
Set olApp = CreateObject("Outlook.Application") Runtime Error Occurs At This Line of Code
Set olNS = olApp.GetNamespace("MAPI")
Set olfolder = olNS.GetDefaultFolder(olFolderInbox)
Set olMailItem = olfolder.Items.Add("IPM.Note")
This is only partail code. I did not want to bore you with details.
I appreciate any help you can give me. We will be in a transition period for some time running both Windows XP and Windows 7 so this will be an ongoing problem. Thank you for your help.