![]() |
If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below. |
|
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
![]()
hi there
I have managed to add some controls to the wordmail screen when word is used sas the editor. This works all nice and dandy. The problem is, is that i do not know how to access the to, subject and other fields withing the mail using outlook at the editor, i can do objmailitem.to = "" etc, to reference the information, btu it doesnt work whe word is the editor any ideas? many thanks Jamie |
#2
|
|||
|
|||
![]()
Show your code. A MailItem has valid subject and other properties whether or
not it's being shown in an Outlook editor window or a WordMail window. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm wrote in message oups.com... hi there I have managed to add some controls to the wordmail screen when word is used sas the editor. This works all nice and dandy. The problem is, is that i do not know how to access the to, subject and other fields withing the mail using outlook at the editor, i can do objmailitem.to = "" etc, to reference the information, btu it doesnt work whe word is the editor any ideas? many thanks Jamie |
#3
|
|||
|
|||
![]()
before i go through and post my code, (i have to strip alot out)
i am able to access the attachments array ok I can set the to and subject properties programmatically, by doinng ObjMailitem.to = ", i can slo set the subject too But, when i click my custom control and check objmailitem.to, it is nothing, empty! i added the following ot control and clicked it objmailitem.to = " objmailitem.subject = "tester" The fields int he email are updated with this information, then when i click my send custom control and check the fields, these values are displayed, even if i add extra info to the fields. Very wierd any clues? if not, i will post my code. this is only apparent when using word as editor, all works fine when using outlook. cheers Jamie |
#4
|
|||
|
|||
![]()
Are you saving the item after you set properties on the WordMail item?
Other than that I can't think of anything offhand, if you can't get Inspector.CurrentItem.Subject after the first Inspector.Activate event has fired then something is definitely wrong. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm wrote in message oups.com... before i go through and post my code, (i have to strip alot out) i am able to access the attachments array ok I can set the to and subject properties programmatically, by doinng ObjMailitem.to = ", i can slo set the subject too But, when i click my custom control and check objmailitem.to, it is nothing, empty! i added the following ot control and clicked it objmailitem.to = " objmailitem.subject = "tester" The fields int he email are updated with this information, then when i click my send custom control and check the fields, these values are displayed, even if i add extra info to the fields. Very wierd any clues? if not, i will post my code. this is only apparent when using word as editor, all works fine when using outlook. cheers Jamie |
#5
|
|||
|
|||
![]()
On 26 Feb, 16:31, "Ken Slovak - [MVP - Outlook]"
wrote: Are you saving the item after you set properties on the WordMail item? Other than that I can't think of anything offhand, if you can't get Inspector.CurrentItem.Subject after the first Inspector.Activate event has fired then something is definitely wrong. -- Ken Slovak [MVP - Outlook]http://www.slovaktech.com Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003 Reminder Manager, Extended Reminders, Attachment Optionshttp://www.slovaktech.com/products.htm wrote in message oups.com... before i go through and post my code, (i have to strip alot out) i am able to access the attachments array ok I can set the to and subject properties programmatically, by doinng ObjMailitem.to = ", i can slo set the subject too But, when i click my custom control and check objmailitem.to, it is nothing, empty! i added the following ot control and clicked it objmailitem.to = " objmailitem.subject = "tester" The fields int he email are updated with this information, then when i click my send custom control and check the fields, these values are displayed, even if i add extra info to the fields. Very wierd any clues? if not, i will post my code. this is only apparent when using word as editor, all works fine when using outlook. cheers Jamie- Hide quoted text - - Show quoted text - Hi Ken Thankyou for the reply. I have gone trhough and stripped my code down. I do hope it is a simple error! I have this class calld OutAddIn Option Explicit 'Object variables for Event procedures Private WithEvents objOutlook As Outlook.Application Private WithEvents objWord As Word.Application Private WithEvents objNS As Outlook.NameSpace Private WithEvents objExpl As Outlook.Explorer Private WithEvents colExpl As Outlook.Explorers Private WithEvents objInsp As Outlook.Inspector Private WithEvents colInsp As Outlook.Inspectors Private WithEvents objMailItem As Outlook.MailItem Private WithEvents objPostItem As Outlook.PostItem Private WithEvents objContactItem As Outlook.ContactItem Private WithEvents objDistListItem As Outlook.DistListItem Private WithEvents objApptItem As Outlook.AppointmentItem Private WithEvents objTaskItem As Outlook.TaskItem Private WithEvents objJournalItem As Outlook.JournalItem Private WithEvents objDocumentItem As Outlook.DocumentItem '************************************************* ***************************** 'These event-aware objects are for Outlook 2002 only 'Uncomment to use in Outlook 2002 COM Add-in 'Private WithEvents colViews As Outlook.Views 'Private WithEvents objResults As Outlook.Results 'Private WithEvents colReminders As Outlook.Reminders '************************************************* ***************************** 'Declare CommandBar, CommandBarButton, and CommandBarComboBox object variables here 'Don't use WithEvents for CommandBar object 'Remove comments to declare object variables for CommandBar objects 'Dim objCB As Office.CommandBar 'Dim WithEvents objCBButton As Office.CommandBarButton 'Dim WithEvents objCBComboBox As Office.CommandBarComboBox oSendLogMenuBar Dim objCBars As Office.CommandBars Dim objCB As Office.CommandBar Dim oMyControl As Office.CommandBarPopup Dim bar As Office.CommandBar Dim WithEvents oSealandSendMenuBar As Office.CommandBarButton Dim WithEvents oVerifyMenuBar As Office.CommandBarButton Dim WithEvents oVerifyExternalMenuBar As Office.CommandBarButton Dim WithEvents oExtractMenuBar As Office.CommandBarButton Dim WithEvents oAboutMenuBar As Office.CommandBarButton Dim WithEvents oHelpMenuBar As Office.CommandBarButton Dim WithEvents oSendLogMenuBar As Office.CommandBarButton Dim WithEvents oWordSealandSendMenuBar As Office.CommandBarButton Dim WithEvents oSealandSendToolBar As Office.CommandBarButton Dim WithEvents oVerifyToolBar As Office.CommandBarButton Dim WithEvents oExtractToolBar As Office.CommandBarButton 'Dim WithEvents oTitleToolBar As Office.CommandBarButton 'Dim WithEvents oValidateExternalToolBar As Office.CommandBarButton 'controls for new inspector objects Dim WithEvents oSealandSendNew As Office.CommandBarButton Dim WithEvents oSealAttachmentNew As Office.CommandBarButton Dim WithEvents oSealAllAttachmentsNew As Office.CommandBarButton Dim WithEvents oVerifyNew As Office.CommandBarButton Dim WithEvents oExtractNew As Office.CommandBarButton Dim ShowSealAndSendControl As Boolean Dim OutlookVersion As String Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _ (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, _ ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long '************************************************* ***************************** '************************************************* ***************************** 'Custom procedu InitHandler(olApp As Outlook.Application, strProgID As String) 'Purpose: Initialize event-aware object variables '************************************************* ***************************** Friend Sub InitHandler(olApp As Outlook.Application, strProgID As String) 'On Error Resume Next Set objOutlook = olApp 'Application Object 'Instantiate a public module-level Outlook application variable Set m_olApp = olApp 'CDO Session if required 'Uncomment for CDO 'Set m_objCDO = CreateObject("MAPI.Session") 'm_objCDO.Logon "", "", False, False 'Declared WithEvents Set objNS = objOutlook.GetNamespace("MAPI") 'NameSpace Object 'Uncomment to use in Outlook 2002 COM Add-in 'Set colReminders = objOutlook.Reminders 'Reminders Object Set colExpl = objOutlook.Explorers 'Explorers Object Set colInsp = objOutlook.Inspectors 'Inspectors Object Set objExpl = objOutlook.ActiveExplorer 'Explorer Object End Sub 'detect the type, then bind the new inspector item to ObjMailitem Private Sub colInsp_NewInspector(ByVal Inspector As Inspector) Dim objItem As Outlook.MailItem Set objInsp = Inspector objInsp.Activate Set objItem = objInsp.CurrentItem Select Case objItem.Class Case olMail Set objMailItem = objItem End Select Set objItem = Nothing End Sub Private Sub objMailItem_Open(Cancel As Boolean) Call addControls End Sub Private Sub addControls() Dim cmdBar As Office.CommandBar Dim cmdBars As Office.CommandBars Set cmdBars = objMailItem.GetInspector.CommandBars On Error Resume Next Dim deletebar As Office.CommandBar Set deletebar = cmdBars.Item("bar") deletebar.Delete deletebar = Nothing On Error GoTo 0 Set cmdBar = cmdBars.Add("bar", 1, False, True) Set oSealAllAttachmentsNew = cmdBar.Controls.Add(Type:=msoControlButton, Temporary:=True) oSealAllAttachmentsNew.Caption = "TruSeal &All Attachments" oSealAllAttachmentsNew.ToolTipText = "Click here to Seal the attachments on this email" oSealAllAttachmentsNew.Tag = "oSealAllAttachmentsNew" oSealAllAttachmentsNew.Style = msoButtonCaption oSealAllAttachmentsNew.Visible = True cmdBar.Visible = True End Sub 'when i detect here the to value, it doesnt show anything. Private Sub oSealAllAttachmentsNew_click(ByVal Ctrl As Office.CommandBarButton, CancelDefault As Boolean) MsgBox objInsp.CurrentItem.To End Sub This is my designers connect class Option Explicit 'Use Implements IDTExtensibility2 in VB5 environment 'Implements IDTExtensibility2 Private gBaseClass As New OutAddIn Private Sub AddinInstance_OnAddInsUpdate(custom() As Variant) 'DebugWrite "AddinInstance_OnAddInsUpdate" End Sub Private Sub AddinInstance_OnBeginShutdown(custom() As Variant) 'DebugWrite "AddinInstance_OnBeginShutdown" End Sub Private Sub AddinInstance_OnConnection(ByVal Application As Object, _ ByVal ConnectMode As AddInDesignerObjects.ext_ConnectMode, _ ByVal AddInInst As Object, custom() As Variant) 'On Error Resume Next 'Evaluate ConnectMode Select Case ConnectMode Case ext_cm_Startup Case ext_cm_AfterStartup Case ext_cm_CommandLine Case ext_cm_Startup End Select 'Don't call InitHandler if Explorers.Count = 0 and Inspectors.Count = 0 If Application.Explorers.count = 0 And Application.Inspectors.count = 0 Then Exit Sub End If 'AddInInst represents COMAddIn object 'Create and Initialize a base class gBaseClass.InitHandler Application, AddInInst.ProgId 'DebugWrite "IDT2 OnConnection" End Sub Private Sub AddinInstance_OnDisconnection(ByVal RemoveMode _ As AddInDesignerObjects.ext_DisconnectMode, custom() As Variant) 'Tear down the class 'IMPORTANT: This event will not fire when 'RemoveMode = ext_dm_HostShutdown 'It will fire when RemoveMode = ext_dm_UserClosed 'gBaseClass.UnInitHandler If RemoveMode = ext_dm_UserClosed Then 'User shutdown removed COM Add-in 'Cleanup custom toolbars by deleting them Else 'Host shutdown End If Set gBaseClass = Nothing If Constants.DEBUG_MODE = True Then DEBUG_FILE.Write "AddinInstance_OnDisconnection: completed" & " " & Time & vbCrLf End If 'DebugWrite "AddinInstance_OnDisconnection" End Sub Private Sub AddinInstance_OnStartupComplete(custom() As Variant) ' 'DebugWrite "AddinInstance OnStartupComplete" End Sub |
#6
|
|||
|
|||
![]()
It looks like a relatively standard implementation of the ItemsCB VB6
template. Don't do anything in NewInspector other than instantiating your Inspector class or event handler. Never call Inspector.Activate in that event. Wait for the first Inspector.Activate event to fire before adding your UI and doing anything else with that Inspector. In NewInspector you're given what's known as a "weak" object reference, where not all properties of the Inspector or Inspector.CurrentItem are populated. In NewInspector you really shouldn't be doing much else than checking for Inspector.CurrentItem.Class or Inspector.CurrentItem.MessageClass and then instantiating your Inspector handler or wrapper class. -- Ken Slovak [MVP - Outlook] http://www.slovaktech.com Author: Absolute Beginner's Guide to Microsoft Office Outlook 2003 Reminder Manager, Extended Reminders, Attachment Options http://www.slovaktech.com/products.htm wrote in message oups.com... snip Hi Ken Thankyou for the reply. I have gone trhough and stripped my code down. I do hope it is a simple error! I have this class calld OutAddIn Option Explicit 'Object variables for Event procedures Private WithEvents objOutlook As Outlook.Application Private WithEvents objWord As Word.Application Private WithEvents objNS As Outlook.NameSpace Private WithEvents objExpl As Outlook.Explorer Private WithEvents colExpl As Outlook.Explorers Private WithEvents objInsp As Outlook.Inspector Private WithEvents colInsp As Outlook.Inspectors Private WithEvents objMailItem As Outlook.MailItem Private WithEvents objPostItem As Outlook.PostItem Private WithEvents objContactItem As Outlook.ContactItem Private WithEvents objDistListItem As Outlook.DistListItem Private WithEvents objApptItem As Outlook.AppointmentItem Private WithEvents objTaskItem As Outlook.TaskItem Private WithEvents objJournalItem As Outlook.JournalItem Private WithEvents objDocumentItem As Outlook.DocumentItem '************************************************* ***************************** 'These event-aware objects are for Outlook 2002 only 'Uncomment to use in Outlook 2002 COM Add-in 'Private WithEvents colViews As Outlook.Views 'Private WithEvents objResults As Outlook.Results 'Private WithEvents colReminders As Outlook.Reminders '************************************************* ***************************** 'Declare CommandBar, CommandBarButton, and CommandBarComboBox object variables here 'Don't use WithEvents for CommandBar object 'Remove comments to declare object variables for CommandBar objects 'Dim objCB As Office.CommandBar 'Dim WithEvents objCBButton As Office.CommandBarButton 'Dim WithEvents objCBComboBox As Office.CommandBarComboBox oSendLogMenuBar Dim objCBars As Office.CommandBars Dim objCB As Office.CommandBar Dim oMyControl As Office.CommandBarPopup Dim bar As Office.CommandBar Dim WithEvents oSealandSendMenuBar As Office.CommandBarButton Dim WithEvents oVerifyMenuBar As Office.CommandBarButton Dim WithEvents oVerifyExternalMenuBar As Office.CommandBarButton Dim WithEvents oExtractMenuBar As Office.CommandBarButton Dim WithEvents oAboutMenuBar As Office.CommandBarButton Dim WithEvents oHelpMenuBar As Office.CommandBarButton Dim WithEvents oSendLogMenuBar As Office.CommandBarButton Dim WithEvents oWordSealandSendMenuBar As Office.CommandBarButton Dim WithEvents oSealandSendToolBar As Office.CommandBarButton Dim WithEvents oVerifyToolBar As Office.CommandBarButton Dim WithEvents oExtractToolBar As Office.CommandBarButton 'Dim WithEvents oTitleToolBar As Office.CommandBarButton 'Dim WithEvents oValidateExternalToolBar As Office.CommandBarButton 'controls for new inspector objects Dim WithEvents oSealandSendNew As Office.CommandBarButton Dim WithEvents oSealAttachmentNew As Office.CommandBarButton Dim WithEvents oSealAllAttachmentsNew As Office.CommandBarButton Dim WithEvents oVerifyNew As Office.CommandBarButton Dim WithEvents oExtractNew As Office.CommandBarButton Dim ShowSealAndSendControl As Boolean Dim OutlookVersion As String Private Declare Function ShellExecute Lib "shell32.dll" Alias "ShellExecuteA" _ (ByVal hwnd As Long, ByVal lpOperation As String, ByVal lpFile As String, _ ByVal lpParameters As String, ByVal lpDirectory As String, ByVal nShowCmd As Long) As Long '************************************************* ***************************** '************************************************* ***************************** 'Custom procedu InitHandler(olApp As Outlook.Application, strProgID As String) 'Purpose: Initialize event-aware object variables '************************************************* ***************************** Friend Sub InitHandler(olApp As Outlook.Application, strProgID As String) 'On Error Resume Next Set objOutlook = olApp 'Application Object 'Instantiate a public module-level Outlook application variable Set m_olApp = olApp 'CDO Session if required 'Uncomment for CDO 'Set m_objCDO = CreateObject("MAPI.Session") 'm_objCDO.Logon "", "", False, False 'Declared WithEvents Set objNS = objOutlook.GetNamespace("MAPI") 'NameSpace Object 'Uncomment to use in Outlook 2002 COM Add-in 'Set colReminders = objOutlook.Reminders 'Reminders Object Set colExpl = objOutlook.Explorers 'Explorers Object Set colInsp = objOutlook.Inspectors 'Inspectors Object Set objExpl = objOutlook.ActiveExplorer 'Explorer Object End Sub 'detect the type, then bind the new inspector item to ObjMailitem Private Sub colInsp_NewInspector(ByVal Inspector As Inspector) Dim objItem As Outlook.MailItem Set objInsp = Inspector objInsp.Activate Set objItem = objInsp.CurrentItem Select Case objItem.Class Case olMail Set objMailItem = objItem End Select Set objItem = Nothing End Sub Private Sub objMailItem_Open(Cancel As Boolean) Call addControls End Sub Private Sub addControls() Dim cmdBar As Office.CommandBar Dim cmdBars As Office.CommandBars Set cmdBars = objMailItem.GetInspector.CommandBars On Error Resume Next Dim deletebar As Office.CommandBar Set deletebar = cmdBars.Item("bar") deletebar.Delete deletebar = Nothing On Error GoTo 0 Set cmdBar = cmdBars.Add("bar", 1, False, True) Set oSealAllAttachmentsNew = cmdBar.Controls.Add(Type:=msoControlButton, Temporary:=True) oSealAllAttachmentsNew.Caption = "TruSeal &All Attachments" oSealAllAttachmentsNew.ToolTipText = "Click here to Seal the attachments on this email" oSealAllAttachmentsNew.Tag = "oSealAllAttachmentsNew" oSealAllAttachmentsNew.Style = msoButtonCaption oSealAllAttachmentsNew.Visible = True cmdBar.Visible = True End Sub 'when i detect here the to value, it doesnt show anything. Private Sub oSealAllAttachmentsNew_click(ByVal Ctrl As Office.CommandBarButton, CancelDefault As Boolean) MsgBox objInsp.CurrentItem.To End Sub This is my designers connect class Option Explicit 'Use Implements IDTExtensibility2 in VB5 environment 'Implements IDTExtensibility2 Private gBaseClass As New OutAddIn Private Sub AddinInstance_OnAddInsUpdate(custom() As Variant) 'DebugWrite "AddinInstance_OnAddInsUpdate" End Sub Private Sub AddinInstance_OnBeginShutdown(custom() As Variant) 'DebugWrite "AddinInstance_OnBeginShutdown" End Sub Private Sub AddinInstance_OnConnection(ByVal Application As Object, _ ByVal ConnectMode As AddInDesignerObjects.ext_ConnectMode, _ ByVal AddInInst As Object, custom() As Variant) 'On Error Resume Next 'Evaluate ConnectMode Select Case ConnectMode Case ext_cm_Startup Case ext_cm_AfterStartup Case ext_cm_CommandLine Case ext_cm_Startup End Select 'Don't call InitHandler if Explorers.Count = 0 and Inspectors.Count = 0 If Application.Explorers.count = 0 And Application.Inspectors.count = 0 Then Exit Sub End If 'AddInInst represents COMAddIn object 'Create and Initialize a base class gBaseClass.InitHandler Application, AddInInst.ProgId 'DebugWrite "IDT2 OnConnection" End Sub Private Sub AddinInstance_OnDisconnection(ByVal RemoveMode _ As AddInDesignerObjects.ext_DisconnectMode, custom() As Variant) 'Tear down the class 'IMPORTANT: This event will not fire when 'RemoveMode = ext_dm_HostShutdown 'It will fire when RemoveMode = ext_dm_UserClosed 'gBaseClass.UnInitHandler If RemoveMode = ext_dm_UserClosed Then 'User shutdown removed COM Add-in 'Cleanup custom toolbars by deleting them Else 'Host shutdown End If Set gBaseClass = Nothing If Constants.DEBUG_MODE = True Then DEBUG_FILE.Write "AddinInstance_OnDisconnection: completed" & " " & Time & vbCrLf End If 'DebugWrite "AddinInstance_OnDisconnection" End Sub Private Sub AddinInstance_OnStartupComplete(custom() As Variant) ' 'DebugWrite "AddinInstance OnStartupComplete" End Sub |
Thread Tools | Search this Thread |
Display Modes | |
|
|
![]() |
||||
Thread | Thread Starter | Forum | Replies | Last Post |
Using Item.Send to e-mail from Access through Outlook 2003 with multiple recipients | Tuck 'n Roll | Outlook and VBA | 1 | December 1st 06 10:02 PM |
Toolbar Appearance Issue with Word & WordMail | Harish Shinde | Outlook - General Queries | 0 | September 27th 06 06:55 AM |
Custom CommandBar in Wordmail Editor. | Sanjay | Add-ins for Outlook | 0 | May 31st 06 11:11 PM |
Help with 'MailItem' object of WordMail Inspector | [email protected] | Add-ins for Outlook | 2 | May 18th 06 08:28 PM |
how to detect programmatically if some code is runing in wordmail | Herve cadieu | Outlook and VBA | 5 | March 14th 06 04:36 PM |