Getting OL info into Word

J

Joseph McGuire

I am looking for a good (and simple) way to get a contact's name (and maybe
his/her company name) and fax number into my fax cover, which is a Word
template I created. I know I can get Name, Address, City etc using the
Insert Address/AddressLayout button; it's more info than I want in a fax
cover but I could live with it--or delete whatever is superfluous. But the
fax number is pretty important; right now I have to go into OLD and
cut-and-paste the fax number into my fax cover.

Some details: I have the same templates on different machines in running
Word (and Office) 2000 (we/ Wine, soon to be scrapped); 2002 (we/ Win
Professional running in a corporate network with a MS Exchange Server; and
2003, (Win XP Pro; my new home office laptop in the standalone mode). My
fax cover is set up as a table with the person's name and fax number in
side-by-side cells. Faxes usually go to only 1 person, but if a fax is to
go to several, I simply add a row in the table for each. If it made things
easier, I could change the template to facilitate this--if I knew how. I
had tried a macro but obviously I don't know how to make anything but the
simplest of macros.

Thanks for any help or suggestions.
 
A

Adam

Hi,

You speak of "templates" but are these coming from Word's
Fax Wizard. Activate this from File>Send To>Fax Recipient
(or perhaps Exhchange).
 
J

Joseph McGuire

No. The template I am using is a Word document I created for professional
use and saved as *.dot.

The fax wizard comes close, i.e., it will get the contact's name and fax
number, which is great. But there are some other limitations: (1) You can
use only the 3 default templates that come with Word and not any custom
template; and something that is a total riddle (2) the Wizard lets you enter
multiple contacts for a default fax cover sheet, but if you actually try
more than 1 the cover sheet will accept none at all! and a minor point (3)
the default templates provide separate formal spaces for other entries for
the Contact, like Company and Phone, but the Wizard leaves these blank!

If there were a way to get my own template to work with the Wizard I would
be happy indeed, especially if I could get the Contact's company in there.
And if somehow it could handle the occasional fax cover for more than one
addressee I would be ecstatic (well, relatively).

(No offense to those who use them but the default Word templates look too
stock to create a professional appearance in certain settings. Mine has my
firm's name and address on it in a way that looks like it relates but is
not identical to our printed letterhead and it is organized to easily allow
the addition of multiple addressees.)
 
J

Joseph McGuire

Thanks for the suggestion. Unfortunately, I got nowhere with your paper (I
am sparing you the gory details) Based on the result below I think I was
doing something wrong (or missing something important) in terms of creating
a Macrobutton.

However, then I tried copying the Macrobutton from a default Word template
into my template and then modifying it to include reference to your macro
InsertAddressFromOutlook (which I had pasted into my custom template) and it
worked. I then added <PR_BUSINESS_FAX_NUMBER> so that the fax number is
returned next to the Contact's name and that worked, too! This gets me 95%
of the way to my goal. My only remaining question is whether I can somehow
get a tab command (or anything else) between the guy's name and number to
move the number to the right of the cell (I have a tab stop where it ought
to go). I can't figure out how to do that inside the macro. Any
suggestion?

What I have now:
NAME FAX
NUMBER
Purdy Fishy 212-123-4567
Dewey Cheatham & Howe
etc.

What I want:
Purdy Fishy
212-123-4567
etc. (I don't know if this will show up properly on this BB but the idea is
to get the Contact's fax number under the heading)
 
G

Graham Mayor

Do you mean like

Public Sub InsertAddressFromOutlook()
Dim strCode, strAddress As String
'Set up the formatting codes in strCode
strCode = "<PR_DISPLAY_NAME>" & vbTab
strCode = strCode & "<PR_BUSINESS_FAX_NUMBER>"
'Let the user choose the name in Outlook
strAddress = Application.GetAddress("", strCode, _
False, 1, , , True, True)
'Insert the name at the current insertion point
If ActiveDocument.ProtectionType <> wdNoProtection Then
bProtected = True
ActiveDocument.Unprotect
ActiveDocument.FormFields("NameOfFormfield").Result = _
strAddress
Else
Selection.TypeText strAddress
End If
End Sub


--
<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
Graham Mayor - Word MVP

My web site www.gmayor.com

<>>< ><<> ><<> <>>< ><<> <>>< <>><<>
 
J

Joseph McGuire

Graham:

I fiddled around with some of your code and the InsertAddressFromOutlook
macro from your site and now it seems to work quite well! What I now end up
with is the Contact's Name, his Fax Number tabbed to the right side of the
cell and the Company name below the Contact. For those for whom there is no
Company or Company name I have a blank I can easily delete. Or if I want to
delete a company name I can do so pretty handily.

I used this:
strCode = "<PR_DISPLAY_NAME>" & vbTab
strCode = strCode & "<PR_BUSINESS_FAX_NUMBER>" & vbCr
strCode = strCode & "<PR_COMPANY_NAME>"

Oddly, the field DISPLAY_NAME returns only a Contact's first and last names
whereas in the Autotext AddressLayout function it returns the Contact's
complete name, including Middle Initial, etc.

One odd issue: I got this to work on my desktop in a network as well as on
my home office stand-alone PC. I have my professional templates set up so
that my secretary uses them, too (they are kept in a folder which we both
have set as the location for User templates. The macro, however, will not
work on her PC. It seems that the macro causes OL to ask for a profile.
Since hers is the only profile, her iteration of OL2002 comes up.
Unfortunately, her collection of personal contacts is not too helpful. She
can easily switch from mine to another attorney's Contacts (or mail,
calendar, etc.), but the macro cannot. Is there a good way to fix this? I
could not figure out how to set up a profile for myself on her networked
computer since I have no idea where my stuff is kept on the network.

Thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top