L
Lorne
When I start Oulook 2007 I get an error message popup saying Outlook had a
serious error with the Microsoft vba addin - do I want to stop it loading in
future ?
If I say I do not want to disable it then outlook starts and seems to work.
I have custom stationery that is used for different email accounts and macro
buttons on the menu open the stationery automatically selecting the right
account to send from so I need vba support. The macros are digitally signed
by a personal signature created using the office 2007 signature tool. The
error only occurs on one machine.
What can I do to track down and prevent this error?
Just in case I copy the vba code below:
//code***************************
Dim NewMail As Outlook.MailItem
Dim objFS, objStationeryFile
Sub NewLetter2()
Const strStationeryFile = "C:\Program Files\Common Files\Microsoft
Shared\Stationery\Letter2.htm"
Set NewMail = Application.CreateItem(olMailItem)
Set objFS = CreateObject("Scripting.FileSystemObject")
Set objStationeryFile = objFS.OpenTextFile(strStationeryFile, 1, False)
NewMail.HTMLBody = objStationeryFile.ReadAll
objStationeryFile.Close
NewMail.Display
End Sub
Sub NewICC()
Const strStationeryFile = "C:\Program Files\Common Files\Microsoft
Shared\Stationery\ICC.htm"
Set NewMail = Application.CreateItem(olMailItem)
Set objFS = CreateObject("Scripting.FileSystemObject")
Set objStationeryFile = objFS.OpenTextFile(strStationeryFile, 1, False)
NewMail.HTMLBody = objStationeryFile.ReadAll
objStationeryFile.Close
NewMail.Display
MyStr = Set_Account("ICC", NewMail)
End Sub
Function Set_Account(ByVal AccountName As String, M As Outlook.MailItem) As
String
Dim OLI As Outlook.Inspector
Dim strAccountBtnName As String
Dim intLoc As Integer
Const ID_ACCOUNTS = 31224
Dim CBs As Office.CommandBars
Dim CBP As Office.CommandBarPopup
Dim MC As Office.CommandBarControl
Set OLI = M.GetInspector
If Not OLI Is Nothing Then
Set CBs = OLI.CommandBars
Set CBP = CBs.FindControl(, ID_ACCOUNTS)
If Not CBP Is Nothing Then
For Each MC In CBP.Controls
intLoc = InStr(MC.Caption, " ")
If intLoc > 0 Then
strAccountBtnName = Mid(MC.Caption, intLoc + 1)
Else
strAccountBtnName = MC.Caption
End If
If strAccountBtnName = AccountName Then
MC.Execute
Set_Account = AccountName
GoTo Exit_Function
End If
Next
End If
End If
Set_Account = ""
Exit_Function:
Set MC = Nothing
Set CBP = Nothing
Set CBs = Nothing
Set OLI = Nothing
End Function
serious error with the Microsoft vba addin - do I want to stop it loading in
future ?
If I say I do not want to disable it then outlook starts and seems to work.
I have custom stationery that is used for different email accounts and macro
buttons on the menu open the stationery automatically selecting the right
account to send from so I need vba support. The macros are digitally signed
by a personal signature created using the office 2007 signature tool. The
error only occurs on one machine.
What can I do to track down and prevent this error?
Just in case I copy the vba code below:
//code***************************
Dim NewMail As Outlook.MailItem
Dim objFS, objStationeryFile
Sub NewLetter2()
Const strStationeryFile = "C:\Program Files\Common Files\Microsoft
Shared\Stationery\Letter2.htm"
Set NewMail = Application.CreateItem(olMailItem)
Set objFS = CreateObject("Scripting.FileSystemObject")
Set objStationeryFile = objFS.OpenTextFile(strStationeryFile, 1, False)
NewMail.HTMLBody = objStationeryFile.ReadAll
objStationeryFile.Close
NewMail.Display
End Sub
Sub NewICC()
Const strStationeryFile = "C:\Program Files\Common Files\Microsoft
Shared\Stationery\ICC.htm"
Set NewMail = Application.CreateItem(olMailItem)
Set objFS = CreateObject("Scripting.FileSystemObject")
Set objStationeryFile = objFS.OpenTextFile(strStationeryFile, 1, False)
NewMail.HTMLBody = objStationeryFile.ReadAll
objStationeryFile.Close
NewMail.Display
MyStr = Set_Account("ICC", NewMail)
End Sub
Function Set_Account(ByVal AccountName As String, M As Outlook.MailItem) As
String
Dim OLI As Outlook.Inspector
Dim strAccountBtnName As String
Dim intLoc As Integer
Const ID_ACCOUNTS = 31224
Dim CBs As Office.CommandBars
Dim CBP As Office.CommandBarPopup
Dim MC As Office.CommandBarControl
Set OLI = M.GetInspector
If Not OLI Is Nothing Then
Set CBs = OLI.CommandBars
Set CBP = CBs.FindControl(, ID_ACCOUNTS)
If Not CBP Is Nothing Then
For Each MC In CBP.Controls
intLoc = InStr(MC.Caption, " ")
If intLoc > 0 Then
strAccountBtnName = Mid(MC.Caption, intLoc + 1)
Else
strAccountBtnName = MC.Caption
End If
If strAccountBtnName = AccountName Then
MC.Execute
Set_Account = AccountName
GoTo Exit_Function
End If
Next
End If
End If
Set_Account = ""
Exit_Function:
Set MC = Nothing
Set CBP = Nothing
Set CBs = Nothing
Set OLI = Nothing
End Function