Results 1 to 11 of 11
  1. #1
    New Lounger
    Join Date
    Jul 2002
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    VBA Automatic Formatting (VBA/Office2000/9.0.4402 SR-1)

    Having created special fonts and colors to be applied to various Subject strings in the Inbox messages, I need to share these settings with others in the team. My thoughts were to code these into a VBA module and have them import the file or maybe distribute as an Add-in.

    However, I have searched in vain for the means to do so in the Outlook 9 Object model and the CDO models. Have I been looking in the wrong place or is it simply not possible?

  2. #2
    Silver Lounger
    Join Date
    Mar 2001
    Location
    Springfield, Ohio, USA
    Posts
    2,136
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: VBA Automatic Formatting (VBA/Office2000/9.0.4402 SR-1)

    This is probably a stupid question, but how did you create "special fonts and colors to be applied to various Subject strings in the Inbox messages." I can show you how to search for a string in the subject, but I don't think that it is possible to format the subject with VBA. However, I'm just an Excel/Powerpoint programmer, trying to learn the Outlook object model.

    BTW, are you the Ozymandias <img src=/S/king.gif border=0 alt=king width=21 height=22> of Shelley fame? (guess he really shouldn't have a smile) --Sam
    <font face="Comic Sans MS">Sam Barrett, CACI </font face=comic>
    <small>And the things that you have heard... commit these to faithful men who will be able to teach others also. 2 Timothy 2:2</small>

  3. #3
    New Lounger
    Join Date
    Jul 2002
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: VBA Automatic Formatting (VBA/Office2000/9.0.4402 SR-1)

    I associated the fonts and their colours using Tools/Organize/Using colors/Automatic Formatting. Had to click "Apply Color" along the way to make the sender appears in the Rule list. (amongst other uses I find this great to make virus alerts appear in red and underlined). This was quite a time-consuming process and I would like to automate it for others.

    The 0zymand1as (Rameses II) handle appeals to my sense of humour. Sums up the utter insignificance of my 'greatest works'. Also the zero and one avoid conflicts with existing user names. Real name: Pete Simpson, ThreatLab Manager, Clearswift Corporation (recovering Wordbasic addict).

  4. #4
    Silver Lounger
    Join Date
    Mar 2001
    Location
    Springfield, Ohio, USA
    Posts
    2,136
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: VBA Automatic Formatting (VBA/Office2000/9.0.4402 SR-1)

    Looks like you need to use CDO (whatever that means). Does this post help any? Do you know how to use CDO? I haven't figured it out yet. HTH --Sam
    <font face="Comic Sans MS">Sam Barrett, CACI </font face=comic>
    <small>And the things that you have heard... commit these to faithful men who will be able to teach others also. 2 Timothy 2:2</small>

  5. #5
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: VBA Automatic Formatting (VBA/Office2000/9.0.4402 SR-1)

    CDO is Collaborative Data Objects and it's only installed with the later versions of Office is you do a custom install and look very carefully in the Outlook options.
    Charlotte

  6. #6
    Plutonium Lounger
    Join Date
    Dec 2000
    Location
    Sacramento, California, USA
    Posts
    16,775
    Thanks
    0
    Thanked 1 Time in 1 Post

    Re: VBA Automatic Formatting (VBA/Office2000/9.0.4402 SR-1)

    There are actually whole books on CDO. If you're going to get serious about working with it (in whichever version), you should probably get one. CDO is actually a wrapper over the MAPI interface, which means you run into difficulties when you have security patches on Outlook. I'm not sure what CDO has to do with formatting inbox messages in the Outlook object model though. I've only dealt with it as a means to send email messages without having to program Outlook itself.
    Charlotte

  7. #7
    Super Moderator jscher2000's Avatar
    Join Date
    Feb 2001
    Location
    Silicon Valley, USA
    Posts
    23,112
    Thanks
    5
    Thanked 93 Times in 89 Posts

    Re: VBA Automatic Formatting (VBA/Office2000/9.0.4402 SR-1)

    I notice this dialog, Automatic Formatting, is duplicated in the View, Customize Current View dialog. If this is part of the definition of a view, maybe that helps in figuring out how to share it. I suggest asking on the Outlook board, as I suspect it's not something you will be able to tap into using VBA.

  8. #8
    Platinum Lounger
    Join Date
    Nov 2001
    Location
    Vienna, Wien, Austria
    Posts
    5,009
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: VBA Automatic Formatting (VBA/Office2000/9.0.4

    As you may/may not know, views are assoiciated with *.psts themselves. I have yet to come across anything in the Outlook Object Model to indicate that customising them is an exposed programmable object.

    A possible workaround is to take an exisiting customised *.pst - with all its special views, strip all the data out of it, and then circulate it as a shell for all your colleagues to shift all the existing data into. Not only is this cumbersome, but also multiple copying tends to give rise to a risk of corruption. Nonetheless, hope this helps.
    Gre

  9. #9
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: VBA Automatic Formatting (VBA/Office2000/9.0.4402 SR-1)

    As far as I'm aware Views (and some rules and possiblly other things as well) are stored as hidden items in your Inbox (or whichever folder they apply to). You can use CDO to determine that they are there but I have yet to figure out whether you can forward these items to others, and if so, how.
    Regards,
    Rory

    Microsoft MVP - Excel

  10. #10
    Platinum Lounger
    Join Date
    Nov 2001
    Location
    Vienna, Wien, Austria
    Posts
    5,009
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Re: VBA Automatic Formatting (VBA/Office2000/9.0.4

    Can you give us more of a nudge? Views, after all (inclusive of colour coding), that are saved with a separate name are available to all folders of that type within the designated *.pst. Rules, on the other hand, would appear to attach, by definition, to the Send/Receive interface; affecting (in principle) the Inbox and Sent items.
    Gre

  11. #11
    WS Lounge VIP rory's Avatar
    Join Date
    Dec 2000
    Location
    Burwash, East Sussex, United Kingdom
    Posts
    6,280
    Thanks
    3
    Thanked 191 Times in 177 Posts

    Re: VBA Automatic Formatting (VBA/Office2000/9.0.4

    It depends on how the view was saved when it was created - could be applied to one folder for everyone, one folder for one person, or all folders of the relevant type. Also, if you're using exchange then the views are stored in your mailbox on the server not in a .pst as far as I'm aware (I get them regardless of which machine I'm on). I imagine that global views are stored somewhere else but haven't yet figured out where. I believe that if you use the organize dialogs to set up colours etc. for emails, those customisations by default only apply to that folder (and its sub-folders)
    <pre>Sub ShowFolderViews()

    Dim oSession As MAPI.Session
    Dim myFolderEntryID As String
    Dim myCDOFolder As Folder
    Dim myHiddenMessages As Messages
    Dim i As Integer, j As Integer

    Set oCDOSession = New MAPI.Session
    oCDOSession.Logon , , False, False
    myFolderEntryID = Session.GetDefaultFolder(olFolderInbox).EntryID
    Set myCDOFolder = oCDOSession.Inbox.Parent.GetFolder(myFolderEntryID )
    Set cHiddenMsgs = myCDOFolder.HiddenMessages
    iNumMessages = cHiddenMsgs.Count
    Debug.Print "total Hidden messages = " & iNumMessages
    For i = 1 To iNumMessages
    If cHiddenMsgs(i).Type = "IPM.Microsoft.FolderDesign.NamedView" Then
    Debug.Print cHiddenMsgs(i).Subject
    End If
    Next i
    End Sub
    </pre>

    should give you the named views stored in the Inbox (need a reference to the CDO library). I'm not entirely sure if this includes the formatting though as the field values for each message mean nothing to me! I had tried looking at the View's XML property in OL2002 but that only gives you a field list not the formatting so it isn't any easier in Office XP.
    I will post back if I find anything that will help with the original question...
    Regards,
    Rory

    Microsoft MVP - Excel

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •