Home |
Search |
Today's Posts |
#1
![]()
Posted to microsoft.public.excel.programming
|
|||
|
|||
![]()
On the 17th October I asked this question: (one response - see below)
I have used some code to send an email message (within Excel) via VBA using Microsoft Outlook As I have many users of the program (more than 50) each having different versions of MS Office, the Microsoft Outlook Object Library that each requires, differs (I guess liabry 9.0 to liabrary 11.0, but there may be other libraries needed) In the past (other projects with single users) the only way I could fix this was to ask the user to open up VBA go to Tools - References, delete the "missing liabrary" and select the liabrary that is applicable to their version of MS Office. If they updated the MS Office version then the process had to be repeated - not ideal, but workable. This project is of a bigger scale as different users will all access the same file on a network so that manual method is now impossible. Is there a way, in VBA, to set the correct liabrary upon opening the file? I am on Excel 2003 using library Outlook 11.0 The subroutine that I use is listed below: It picks up the email address (EmailAddress) and the message (MyMessage) off the file in the process before branching to this sub-routine Sub EmailUnansweredQuestioned(EmailAddress, MyMessage) Dim objOL As New Outlook.Application Dim objMail As MailItem Dim appOL Dim oCtl As Office.CommandBarControl Dim oPop As Office.CommandBarPopup Dim oCB As Office.CommandBar Dim oNS As Outlook.Namespace Dim oItem As Object Dim CC As String Dim Response As String Response = "" MyMessage = "We have noted that certain questions from the Internal Control Matrix (listed below) have still to be answered:" & vbCr & MyMessage & vbCr & vbCr & "Please could you attend to this matter at your earliest convenience." & vbCr & vbCr & "Thank you," & vbCr & "The ICM Team" Response = MsgBox("Send the following message to " & EmailAddress & "?" & vbCr & vbCr & MyMessage, vbYesNo) If Response = vbYes Then Set appOL = CreateObject("Outlook.Application") Set objOL = New Outlook.Application Set objMail = objOL.CreateItem(olMailItem) With objMail .To = EmailAddress .Subject = "Internal Control Matrix" .Body = MyMessage .Send End With Set appOL = CreateObject("Outlook.Application") Set oNS = appOL.GetNamespace("MAPI") Set oCtl = appOL.ActiveExplorer.CommandBars.FindControl(ID:=5 488) 'Reset objects Set objMail = Nothing Set objOL = Nothing Set appOL = Nothing Set oCtl = Nothing End If End Sub Bob Philips responded: (And I thank you, Bob, for you time) "The easiest way is to get a machine with the lowest version that any of your users will use, and develop in that version. It will work on all versions and save any grief of using functionality that they don't have." The suggested line will not work as the Outlook library needs to match the version of Excel on the machine loading the file. Am I missing something? Any help would be greatly appreciated. Peter Bircher |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Forum | |||
Selecting correct MS Outlook Object Library | Excel Programming | |||
Microsoft Outlook Library | Excel Discussion (Misc queries) | |||
Outlook 11.0 Library | Excel Programming | |||
Outlook 11 Outlook 10 Object Library Compatibility Issues | Excel Programming | |||
Attaching an Outlook Library programatically | Excel Programming |