![]() |
Selecting correct MS Outlook Object Library (repeat)
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 |
Selecting correct MS Outlook Object Library (repeat)
I think you are, because if you develop on the lowest machine, the system
will compensate upward when used on a later version. It doesn't work the other way unfortunately. Have you tried it? If so, what are you experiencing. -- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Pete" wrote in message ... 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 |
Selecting correct MS Outlook Object Library (repeat)
Thanks, Bob
I have just done a test on two machines in my office, setting the liabrary to 10.0 on one machinse and running the email program on another which would use liabrary 11.0 And it DID work! Yea! As this method is a possible work-around it looks as though I will have to live with it. I was hoping that I could programatically, dynamically select the relevant library on the machine in use. Now the tricky job of trying to locate the machine with the lowest common denominator out of about 50 located all over South Africa! Peter "Bob Phillips" wrote in message ... I think you are, because if you develop on the lowest machine, the system will compensate upward when used on a later version. It doesn't work the other way unfortunately. Have you tried it? If so, what are you experiencing. -- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Pete" wrote in message ... 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 |
Selecting correct MS Outlook Object Library (repeat)
Pete,
Perhaps you could create a simple Excel workbook with this workbook open code in it Private Sub Workbook_Open() Dim ol As Object Set ol = CreateObject("Outlook.Application") MsgBox ol.Version Set ol = Nothing End Sub send it out to all 50, and ask them to note what the msgBox says and send details back to you. -- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Pete" wrote in message ... Thanks, Bob I have just done a test on two machines in my office, setting the liabrary to 10.0 on one machinse and running the email program on another which would use liabrary 11.0 And it DID work! Yea! As this method is a possible work-around it looks as though I will have to live with it. I was hoping that I could programatically, dynamically select the relevant library on the machine in use. Now the tricky job of trying to locate the machine with the lowest common denominator out of about 50 located all over South Africa! Peter "Bob Phillips" wrote in message ... I think you are, because if you develop on the lowest machine, the system will compensate upward when used on a later version. It doesn't work the other way unfortunately. Have you tried it? If so, what are you experiencing. -- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Pete" wrote in message ... 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 |
Selecting correct MS Outlook Object Library (repeat)
Thanks, Bob
That might help Peter "Bob Phillips" wrote in message ... Pete, Perhaps you could create a simple Excel workbook with this workbook open code in it Private Sub Workbook_Open() Dim ol As Object Set ol = CreateObject("Outlook.Application") MsgBox ol.Version Set ol = Nothing End Sub send it out to all 50, and ask them to note what the msgBox says and send details back to you. -- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Pete" wrote in message ... Thanks, Bob I have just done a test on two machines in my office, setting the liabrary to 10.0 on one machinse and running the email program on another which would use liabrary 11.0 And it DID work! Yea! As this method is a possible work-around it looks as though I will have to live with it. I was hoping that I could programatically, dynamically select the relevant library on the machine in use. Now the tricky job of trying to locate the machine with the lowest common denominator out of about 50 located all over South Africa! Peter "Bob Phillips" wrote in message ... I think you are, because if you develop on the lowest machine, the system will compensate upward when used on a later version. It doesn't work the other way unfortunately. Have you tried it? If so, what are you experiencing. -- HTH Bob (there's no email, no snail mail, but somewhere should be gmail in my addy) "Pete" wrote in message ... 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 |
All times are GMT +1. The time now is 06:56 AM. |
Powered by vBulletin® Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
ExcelBanter.com