Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Word User manual link to Excel

Status
Not open for further replies.

BillB66

Technical User
Apr 24, 2008
63
AU
I have a phone user manual in word 2007

that contains access codes

eg To call forward your phone dial the "fwd all code" #1

The access codes are stored in an excel worksheet and they may vary between sites.

What I want is some code that will check the excel worksheet
for the text "fwd all code" and get the code from the next cell and put it into the word document.

This way I can easily update all the access codes in the USer guide without having to manually edit them.
 
I doubt if you can find a "made to order" solution to your problem in this site just by stating your requirement. Perhaps you should charter the services of some expert. Or perhaps you should attempt to create your own solution and ask wherever you get stuck on a specific issue.

Good luck,
Engin
 
I dont expect someone to write it all for me , just after a hint as to whether it is at all possible.

I can write some excel vba code , but have never dabbled in word.

All I am really after is how to reference an excel cell from within word.
 
All I am really after is how to reference an excel cell from within word. "

And put to where in Word?

Essentially, as pseudo-code, you could have:

At the Selection point:
Code:
[COLOR=red]' assuming an instance of Excel is
' existing and appropriate file open[/color red]
Dim strWhatever As String
StrWhatever = [i]Excel Cell text[/i]
Selection.TypeText strWhatever

Into a Bookmark:
Code:
[COLOR=red]' assuming an instance of Excel is
' existing and appropriate file open[/color red]
Dim strWhatever As String
StrWhatever = [i]Excel Cell text[/i]
ActiveDocument.Bookmarks("Here").Range.text = strWhatever

Into a Formfield:
Code:
[COLOR=red]' assuming an instance of Excel is
' existing and appropriate file open[/color red]
Dim strWhatever As String
StrWhatever = [i]ExcelInstance Cell text[/i]
ActiveDocument.Formfields("FromExcel").Result = strWhatever

The basics are (from Word - since that is what you seem to want):

1. create an instance of Excel, or use an existing instance of Excel (using GetObject or CreateObject)

2. use that instance to get the Excel file open (if not already open)

3. get the value of the cell you want

4. put that value into....some place in your Word document.

Gerry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top