Is it possible to link to information in Word documents?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Here's a brain tickler:

I've developed a custom form in Outlook for our company...

which basically has the same information as a document we use in the
company...

(Which, coincidentally, is repeated elsewhere in a couple of other places)

Question is, would it be possible to auto-fill that information either way:

I.E. Fill in the form in Outlook and let Word know how to automatically fill
in the right information from the fields
OR
Fill in the form in Word and let the Outlook form know how to automatically
fill in the right information in the fields?

I know how to do this between Excel documents quick and easy. Question is,
does that ease cross applications?
 
Basically, yes you can do all that. Both Word and Outlook support VBA, which
allows you to program against any Office application. Custom fields in
custom forms expose their names/properties via the UserProperties Collection,
so that's what you'd use to read/set those values.

However, your question is fairly general in scope. It really depends on
which application is providing the data to whom. If you can provide some
specifics, we can help guide you through any programming tasks.
 
Well we have a form in Word that has all basic information in it on potential
clients such as Company name, address, phone # owners' names, etc.

And I created a shared custom form in Outlook for our office to use that
pretty much does the same thing using the contacts template.

I'm not sure if it would be easier to input the data into the Outlook form
and have a Word document get the data or the other way around But we are
essentially duplicating our work 2 or 3 times with every potential client we
come across.
 
I would say it's easier to populate Word from your custom form. First, I'd
setup a Word document (or template) that uses named Bookmarks. These
Bookmarks should have the same name as your custom fields. Then you can use
the Bookmarks collection in Word with the UserProperties collection from your
custom form to match and populate.

--
Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/
 
Thanks Eric. One more question, please.

The Word & bookmarks part I understand.

What I can't figure out, however is WHERE my custom form is saved to link
the information to, and I was wondering if you could help me locate it.

In my company, we SHARE a drive on the network (S:), it is the only place
where information can be accessed by anyone. Outlook, however is installed
on the server. Does this mean that all the published, custom forms we have
are on the server as well? I have no direct access to that. Is that the
only way to "browse" to link the information in the word document to the
custom form?
 
Better yet, Eric, if that is an issue (I don't know where the Outlook form is
and can't get to it), and it is possible to go the other way (have the form
populate from a Word document), that might be the easiest way to go. How do
I go about telling Outlook where to get data in a custom form?

If you could give me a very simple example I could probably figure out the
rest. Say I make a form in Outlook with a field "ClientName" and have a Word
document with a field "ClientName" in it. What do I have to do with the
field in Outlook to tell it to get the data from the Word Document?
 
Where you publish the form depends mainly on who needs to access it, and
partially on what kind of form it is. See this link:

Saving and Publishing Microsoft Outlook Custom Forms:
http://www.outlookcode.com/d/formpub.htm

For custom message forms, they are generally published to the Personal or
Organization forms libraries, whereas others are published to a folder
(probably a shared Public Folder in your case if you are using Exchange).

--
Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/
 
I'm still a little hazy over your business requirements, and to why you need
to use both a Word document and a custom Outlook form that seems to duplicate
each other's functionality.

Word can read from Outlook using the Outlook Object Model in Word VBA, and
Outlook custom forms can read Word documents using the Word Object Model in
custom VBScript inside the form itself.

Automating Outlook from other Microsoft Office applications:
http://msdn.microsoft.com/library/e...tOfficeApplications_HV05273034.asp?frame=true

The concept is similar from an Outlook custom form that works with Word,
except you'd be using VBScript instead of VBA.

--
Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/
 
Eric Legault said:
I'm still a little hazy over your business requirements, and to why you need
to use both a Word document and a custom Outlook form that seems to duplicate
each other's functionality.

You're right, it is duplication and fairly stupid but it is unavoidable for
now. Here's what we do:

A sales rep comes in with a filled in (by hand) Request for Quote (RFQ) for
our company's services and gives it to me. This represents a potential
client.

I must first input the information from that RFQ into the electronic format
we have (word document) so we have a "pretty" typed-up version. Name,
address, phone number, contact name, socials, all sorts of stuff.

Then I must fill out another form that asks for basically all the same
information given to us to apply for a quote for Workers' Compensation for
that company. This is a custom form (Word document) given to us by the
insurance company that is locked, it can not be edited or changed by me,
unfortunately.

THEN I must fill out our "CRM" which is a custom Outlook form created by me
as a means to share among sales persons, the director, president of the
company, whatever, at a glance what the sales department is up to. It
contains, you guesed it, all of the same general information on the original
RFQ I was given.

Now...there's nothing I can do about the insurance form (Word document)
since it is locked.

But for the electronic version of our RFQ...and for the CRM (custom Outlook
form based on the standard contact form), I would like to save myself a
little hassle in duplicating THAT at least.

So, optimally now, what I would like to be able to do is get a handwritten
RFQ from a sales rep, and go straight to the electronic version of that form
we have, enter the data there...and then open a new "contact" in our custom
CRM form in Outlook...

And tell it to grab all the information needed from the RFQ I just typed in...

and be done.

So what I'm missing is how to tell Outlook for a text field, for example,
named "ClientName," how to get that information from a Word document I have
saved on the server with a bookmarked field named "ClientName."

Once I knew how to do that, I'm pretty certain I could figure out the rest
of the fields as well

Thanks for your help, Eric.
 
Okay, so this is how I see this working:

- create instance of your custom form
- add a button on the form (or toolbar button, but more complicated) that
has VBScript in the ButtonName_Click event with code similar to this:

Set wrd = CreateObject("Word.Application")
wrd.Documents.Open FileName:="C:\MyFolder\Sample.doc"

You can then work with the ActiveDocument object to get at the Bookmarks
collection. You MUST create these bookmarks using the same name as the
corresponding Outlook field name in your custom form so that you know what to
look for when you navigate through the Bookmarks collection.

You can get some basic information on programming with Word here:

Frequently Asked Visual Basic Questions [Word 2003 VBA Language Reference]
-- Word:
http://msdn.microsoft.com/library/en-us/vbawd11/html/wohowFrequentlyAsked1_HV05210857.asp?frame=true

Aside from that, you insert the values from a Bookmark object by retrieving
a UserProperty object from the Item.UserProperties collection.

That's really all there is to it, but I'm afraid if you are very new to
Visual Basic than all this may still be a lot of work for you. If you're
still having problems, I can try to find some time to write more in depth
code for you but it may take me a while.

--
Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/
 
Eric, you rock! Thanks, man...

Eric Legault said:
Okay, so this is how I see this working:

- create instance of your custom form
- add a button on the form (or toolbar button, but more complicated) that
has VBScript in the ButtonName_Click event with code similar to this:

Set wrd = CreateObject("Word.Application")
wrd.Documents.Open FileName:="C:\MyFolder\Sample.doc"

You can then work with the ActiveDocument object to get at the Bookmarks
collection. You MUST create these bookmarks using the same name as the
corresponding Outlook field name in your custom form so that you know what to
look for when you navigate through the Bookmarks collection.

You can get some basic information on programming with Word here:

Frequently Asked Visual Basic Questions [Word 2003 VBA Language Reference]
-- Word:
http://msdn.microsoft.com/library/en-us/vbawd11/html/wohowFrequentlyAsked1_HV05210857.asp?frame=true

Aside from that, you insert the values from a Bookmark object by retrieving
a UserProperty object from the Item.UserProperties collection.

That's really all there is to it, but I'm afraid if you are very new to
Visual Basic than all this may still be a lot of work for you. If you're
still having problems, I can try to find some time to write more in depth
code for you but it may take me a while.

--
Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/


Angyl said:
You're right, it is duplication and fairly stupid but it is unavoidable for
now. Here's what we do:

A sales rep comes in with a filled in (by hand) Request for Quote (RFQ) for
our company's services and gives it to me. This represents a potential
client.

I must first input the information from that RFQ into the electronic format
we have (word document) so we have a "pretty" typed-up version. Name,
address, phone number, contact name, socials, all sorts of stuff.

Then I must fill out another form that asks for basically all the same
information given to us to apply for a quote for Workers' Compensation for
that company. This is a custom form (Word document) given to us by the
insurance company that is locked, it can not be edited or changed by me,
unfortunately.

THEN I must fill out our "CRM" which is a custom Outlook form created by me
as a means to share among sales persons, the director, president of the
company, whatever, at a glance what the sales department is up to. It
contains, you guesed it, all of the same general information on the original
RFQ I was given.

Now...there's nothing I can do about the insurance form (Word document)
since it is locked.

But for the electronic version of our RFQ...and for the CRM (custom Outlook
form based on the standard contact form), I would like to save myself a
little hassle in duplicating THAT at least.

So, optimally now, what I would like to be able to do is get a handwritten
RFQ from a sales rep, and go straight to the electronic version of that form
we have, enter the data there...and then open a new "contact" in our custom
CRM form in Outlook...

And tell it to grab all the information needed from the RFQ I just typed in...

and be done.

So what I'm missing is how to tell Outlook for a text field, for example,
named "ClientName," how to get that information from a Word document I have
saved on the server with a bookmarked field named "ClientName."

Once I knew how to do that, I'm pretty certain I could figure out the rest
of the fields as well

Thanks for your help, Eric.
 
Here's some code I whipped up for you. Just add a Command button to the
form, paste the code into the Script Editor behind your custom form, and
change the button name if required, as well as the name of your custom
field/bookmark name and path to your Word document:

Sub CommandButton1_Click()
On Error Resume Next

Dim objWord, objDoc
Dim objUProp, objUProps
Dim objBM

Set objWord = CreateObject("Word.Application")
If objWord Is Nothing Then
MsgBox "Error!"
Exit Sub
End If

Set objDoc = objWord.Documents.Add("C:\Temp\mydoc.doc", , , True)
If objDoc Is Nothing Then
MsgBox "Error!"
Exit Sub
End If

objWord.Visible = True

Set objUProps = Item.UserProperties
For Each objUProp In objUProps
If objDoc.Bookmarks.Exists(objUProp.Name) Then
Set objBM = objDoc.Bookmarks.Item(objUProp.Name)
objBM.Select
objDoc.Application.Selection.MoveEnd 2, 1
objUProp.Value = objWord.Selection
End If
Set objBM = Nothing
Next

Set objUProps = Nothing
Set objUProp = Nothing
objDoc.Close
Set objDoc = Nothing
objWord.Quit
Set objWord = Nothing
End Sub

--
Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/


Angyl said:
Eric, you rock! Thanks, man...

Eric Legault said:
Okay, so this is how I see this working:

- create instance of your custom form
- add a button on the form (or toolbar button, but more complicated) that
has VBScript in the ButtonName_Click event with code similar to this:

Set wrd = CreateObject("Word.Application")
wrd.Documents.Open FileName:="C:\MyFolder\Sample.doc"

You can then work with the ActiveDocument object to get at the Bookmarks
collection. You MUST create these bookmarks using the same name as the
corresponding Outlook field name in your custom form so that you know what to
look for when you navigate through the Bookmarks collection.

You can get some basic information on programming with Word here:

Frequently Asked Visual Basic Questions [Word 2003 VBA Language Reference]
-- Word:
http://msdn.microsoft.com/library/en-us/vbawd11/html/wohowFrequentlyAsked1_HV05210857.asp?frame=true

Aside from that, you insert the values from a Bookmark object by retrieving
a UserProperty object from the Item.UserProperties collection.

That's really all there is to it, but I'm afraid if you are very new to
Visual Basic than all this may still be a lot of work for you. If you're
still having problems, I can try to find some time to write more in depth
code for you but it may take me a while.

--
Eric Legault (Outlook MVP, MCDBA, MCTS: Messaging & Collaboration)
Try Picture Attachments Wizard for Outlook:
http://www.collaborativeinnovations.ca
Blog: http://blogs.officezealot.com/legault/


Angyl said:
:

I'm still a little hazy over your business requirements, and to why you need
to use both a Word document and a custom Outlook form that seems to duplicate
each other's functionality.

You're right, it is duplication and fairly stupid but it is unavoidable for
now. Here's what we do:

A sales rep comes in with a filled in (by hand) Request for Quote (RFQ) for
our company's services and gives it to me. This represents a potential
client.

I must first input the information from that RFQ into the electronic format
we have (word document) so we have a "pretty" typed-up version. Name,
address, phone number, contact name, socials, all sorts of stuff.

Then I must fill out another form that asks for basically all the same
information given to us to apply for a quote for Workers' Compensation for
that company. This is a custom form (Word document) given to us by the
insurance company that is locked, it can not be edited or changed by me,
unfortunately.

THEN I must fill out our "CRM" which is a custom Outlook form created by me
as a means to share among sales persons, the director, president of the
company, whatever, at a glance what the sales department is up to. It
contains, you guesed it, all of the same general information on the original
RFQ I was given.

Now...there's nothing I can do about the insurance form (Word document)
since it is locked.

But for the electronic version of our RFQ...and for the CRM (custom Outlook
form based on the standard contact form), I would like to save myself a
little hassle in duplicating THAT at least.

So, optimally now, what I would like to be able to do is get a handwritten
RFQ from a sales rep, and go straight to the electronic version of that form
we have, enter the data there...and then open a new "contact" in our custom
CRM form in Outlook...

And tell it to grab all the information needed from the RFQ I just typed in...

and be done.

So what I'm missing is how to tell Outlook for a text field, for example,
named "ClientName," how to get that information from a Word document I have
saved on the server with a bookmarked field named "ClientName."

Once I knew how to do that, I'm pretty certain I could figure out the rest
of the fields as well

Thanks for your help, Eric.
 
Back
Top