• Exporting User defined field OL2007

    Author
    Topic
    #473014

    I use outlook in stand-alone mode at home as my overall PIM. I have created a new user defined field “in this folder” and can maintain it through a table view or the all fields view for a contact card. It is persistent and works fine. It happens to be date format.

    I now want to export this field, along with some standard OL fields into an excel file. It does not appear to be available in the “map fields” process.

    Am I missing a trick or is this not possible?
    Mike C

    Viewing 8 reply threads
    Author
    Replies
    • #1254740

      Unfortunately Outlook’s export wizard does not have native capacity to export user-defined fields. You have two options:

      1. create and open a table view that includes your udf, and copy and paste the view into Excel

      2. code Outlook VBA to export them, and that will not be trivial

    • #1254754

      Thanks John (I think) – it sounds a bit daunting. I had hoped that I could map & rename fields as they all passed across in a nice joined-up process. I did try copy and paste but it messed up the street names where (on multi-line items) there is a hidden LF that forces a new row part way across the spreadsheet and breaks up the columnar structure.

      Oh well

      Mike C

      • #1254775

        I did try copy and paste but it messed up the street names where (on multi-line items) there is a hidden LF that forces a new row part way across the spreadsheet and breaks up the columnar structure.

        Mike, will your export target always be Excel? It will be much easier to write Excel VBA code that shuffles the extra rows into a new column; you could post a censored version (no personal information) of the Excel spreadsheet in the Excel Forum and ask for help. But there may be some export code here in this Forum, or in the WSL Lounge VBA Forum, or possibly in outlookcode.com, that can be modified. Run a search and see what you find.

    • #1256448

      John thanks – I have moved things along quite a bit by mugging up on vba in outlook and stealing snatches of code from various web sites.

      I have now got code which writes selected built-in outlook contact fields and some of the fields that I have created through “user defined fields in this folder” – smart. It is focussed and precise, and quite fast enough for my purposes.

      What has absolutely stumped me is that I have some older information in 2 of the 4 built-in User Field 1,2,3,4 and I want to reference those. I cannot find anywhere that gives me the addressable property of these fields that I can use in code like “itm.account” to snatch its value. All the references I have found talk about the “real” built-in fields or “user defined fields”, both of which I have cracked. No references to the built-in User fields that I can find. I have tried various obvious (to me) variations like “userfield1”; userdefinedfield1 etc. I have also tried refering to the property I established so that a useful name appears in a maintenance table. No luck!

      Can you point me anywhere?

      Thanks

      Mike C

    • #1256450

      John,,
      got it! sorry to trouble you. I found it before but was misled by the description into thinking it was something else. Where do all these hours go to.

      Cheers,

      Mike C

    • #1256451

      Mike, I’m glad you found what you are looking for, because I had not found an answer to your question. Could you post your code for future Lounger use? Within the Outlook VBE, with a single open Outlook Contact with custom fields, does this code expose all the built-in userproperties?

      Code:
      Sub ShowCustomFields()
        Dim lngC As Long
      
        If CBool(Inspectors.Count) Then
          With ActiveInspector.CurrentItem
            If .Class = olContact Then
              Debug.Print .User1 & vbTab & .User2 & vbTab & .User3 & vbTab & .User4 ' < this line added
              For lngC = 1 To .UserProperties.Count
                Debug.Print lngC & vbTab & .UserProperties(lngC).Name & vbTab & .UserProperties(lngC).Value
              Next lngC
            End If
          End With
        End If
      End Sub
    • #1256458

      John hi,

      Yes I will post “my” code. At the last tidy-up of it I drew heavily on material already on the net. What are the ethics of making that available in this context? If I do I will have to put some guidance and attribution in there so it wont be instant….

      Regarding your code, I have drawn it into my outlook installation, and it appears to run when I have a single contact selected. but it does not present me with any output. I was expecting the printer to burst into life (debug.print) but no.

      Please remember novice! what next
      Mike C

    • #1256459

      Debug.Print ‘prints’ – that is, it displays – in the Immediates window in the Outlook VBE. To toggle display of the Immediates window in the VBE, press Control G. You should have a narrow window open directly below the code window. That’s where you will see results, if any, from Debug.Print. The Immediates window and the Locals window are useful debugging tools.

      Sub DoYouSeeThis()
      Debug.Print “If you can see this message in the VBE you are looking at the Immediates Window”
      End Sub

    • #1256477

      John,

      thats a blow, I filled in a fast reply and it just dissapeared when I tried to add it…

      Your code works fine. Depending on the contact I have open, it shows the user defined fields that are populated (and not the ones that are available and empty). clearly it does not show the User fileds 1-4 and that might also be useful. So would available and unpopulated. Anyway, now I have that loaded I am sure I will use it again as well.

      you didnt mention the ethics of me posting code that wa ssubstantially someone elses – are there any?

      Thanks agian

      Mike C

    • #1256478

      OK, if you have code that gets to predefined user fields 1 through 4 please post it, because I quit looking when you said you had solved the problem. Did you use something like this: http://www.tech-archive.net/Archive/Outlook/microsoft.public.outlook.program_forms/2006-06/msg00037.html ?

      The subject of posting third party code is a bit messy – we all learn by using someone else’s code. Review the copyright section of WSL Rules, Rule 13, and then make a decision about if you should attribute. I usually say “based on code by Sue Mosher” or such.

      Edit: see edit to my code a couple of posts above – let me know if that gets the values for the four built in User fields. For posterity, see http://msdn.microsoft.com/en-us/library/aa210907%28v=office.11%29.aspx

    Viewing 8 reply threads
    Reply To: Exporting User defined field OL2007

    You can use BBCodes to format your content.
    Your account can't use all available BBCodes, they will be stripped before saving.

    Your information: