Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Document Management / March 2008

Tip: Looking for answers? Try searching our database.

Default values

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
donwb - 30 Mar 2008 18:55 GMT
Office 2003 on Win XP
In Word, to print a label from Outlook's address book, I do the following.
Select Tools / Letters & Mailings / Envelopes & Labels
Then click the Address Book Icon
Then click OK on the Outlook "Profile Name"
This brings up the Address Book "Select Name" dialog box.
That's all fine and as expected.
However, under the "Name" heading in the Address Book "Select Name" dialog
box,
the "Full Name" field from the Outlook address book is shown as the default.
I would prefer it to be the "Last Name" field from the address book instead.
Can this (default) setting be changed and if so how?
donwb
Doug Robbins - Word MVP - 30 Mar 2008 20:51 GMT
I think that if what you want to do is change the way the names are
displayed, you will need to use a userform that is populated with the
Outlook Contact Details.

Here is the code that you would use in the Initialize event of the userform
to populate a combobox on the form with Outlook Contact details:

Private Sub UserForm_Initialize()
     Dim oApp As Outlook.Application
     Dim oNspc As NameSpace
     Dim oItm As ContactItem
     Dim x As Integer
     If Not DisplayStatusBar Then
     DisplayStatusBar = True
     End If
     StatusBar = "Please Wait..."
     x = 0
     Set oApp = CreateObject("Outlook.Application")
     Set oNspc = oApp.GetNamespace("MAPI")
     For Each oItm In oNspc.GetDefaultFolder _
     (olFolderContacts).Items
     With Me.cboContactList
     .AddItem (oItm.LastName & ", " & oItm.FirstName)
     .Column(1, x) = oItm.BusinessAddress
     .Column(2, x) = oItm.BusinessAddressCity
     .Column(3, x) = oItm.BusinessAddressState & ", " &
oItm.BusinessAddressPostalCode
  '   .Column(4, x) = oItm.BusinessAddressPostalCode
     End With
     x = x + 1
     Next oItm
     StatusBar = ""
     Set oItm = Nothing
     Set oNspc = Nothing
     Set oApp = Nothing
   Dim MyArray() As Variant, i As Integer, j As Integer, m As Integer, n As
Integer, target As Document, newtable As Table, myitem As Range
   'Load client data into MyArray
  MyArray = cboContactList.List()
   ' Create a new document containing  a table
  Application.ScreenUpdating = False
    Set target = Documents.Add
   Set newtable = target.Tables.Add(Range:=target.Range(0, 0),
numrows:=cboContactList.ListCount, NumColumns:=5)
   ' Populate the cells of the table with the contents of the array
   For i = 1 To cboContactList.ListCount
       For j = 1 To 4
           newtable.Cell(i, j).Range.InsertBefore MyArray(i - 1, j - 1)
       Next j
   Next i
   ' sort the table
   newtable.Sort ExcludeHeader:=False ', FieldNumber:="Column 1",
SortFieldType:=wdSortFieldText, SortOrder:=wdSortOrderAscending
   i = newtable.Rows.Count
   ' Get the number of columns in the table of client details
   j = 4
   ' Set the number of columns in the Listbox to match
   ' the number of columns in the table of client details
   cboContactList.ColumnCount = 4
   ' Define an array to be loaded with the client data
   Dim NewArray() As Variant
   'Load client data into MyArray
   ReDim NewArray(i, j)
   For n = 0 To j - 1
       For m = 0 To i - 1
           Set myitem = newtable.Cell(m + 1, n + 1).Range
           myitem.End = myitem.End - 1
           NewArray(m, n) = myitem.Text
       Next m
   Next n
  ' Load data into ListBox1
   cboContactList.List() = NewArray
   target.Close wdDoNotSaveChanges
  Application.ScreenUpdating = True

End Sub

If you have not come across userforms, See the article "How to create a
Userform" at:

http://word.mvps.org/FAQs/Userforms/CreateAUserForm.htm

Signature

Hope this helps.

Please reply to the newsgroup unless you wish to avail yourself of my
services on a paid consulting basis.

Doug Robbins - Word MVP

> Office 2003 on Win XP
> In Word, to print a label from Outlook's address book, I do the following.
[quoted text clipped - 11 lines]
> Can this (default) setting be changed and if so how?
> donwb
donwb - 31 Mar 2008 18:32 GMT
Hi Doug
Many thanks for the input, but that's a bit above me.
I thought it would be possible to simply change the default setting for
Envelopes & Labels in Word.
donwb

>I think that if what you want to do is change the way the names are
>displayed, you will need to use a userform that is populated with the
[quoted text clipped - 94 lines]
>> Can this (default) setting be changed and if so how?
>> donwb

Rate this thread:






 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.