Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 04-20-2012, 12:54 PM
peterock peterock is offline Advanced Question about Links to Excel Windows XP Advanced Question about Links to Excel Office 2007
Novice
Advanced Question about Links to Excel
 
Join Date: Apr 2012
Posts: 3
peterock is on a distinguished road
Exclamation Advanced Question about Links to Excel

Hello,



I am a first time poster, please excuse me if I posted in the wrong sub section.

I am trying to create a word document for work that will improve the efficiency of a certain task. Here is what I would like to do.
  • I need word to pull data from excel and insert it to.. let's call it "LINE 1" of word. This part I have done already. It looks like this:
{ LINK Excel.Sheet.8 "C:\\Documents and Settings\\*FAKE FOLDER\\FAKEFILE.xlsx" "Sheet1!R2C1:R2C3" \a \f 4 \r \* MERGEFORMAT }

[Note: This part works. Now comes the part I do NOT know.]
  • I need a link that links a cell from excel to "LINE 2" of word ONLY IF the previous link on "LINE 1" has data that exists in excel.
How do you do a conditional link like that?

Please help and I appreciate the one's who do!

-Pete
Reply With Quote
  #2  
Old 04-20-2012, 02:23 PM
Charles Kenyon Charles Kenyon is offline Advanced Question about Links to Excel Windows Vista Advanced Question about Links to Excel Office 2010 32bit
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,140
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

This isn't exactly a "link" but a simple mailmerge. What you want is an IF field.

This example shows a mergefield named Field1. It prints:
Field 1: contents of field 1
on a separate line if, and only if, there are contents in field1.

If field1 can be a negative number you would want the condition to be <> 0.

Turn on display of field codes when writing fields. Alt-F9

This is what the fields will look like. Note the line break in the middle of the IF field which is actually a paragraph mark in Word.

{ IF { MERGEFIELD Field1 } > 0 "Field1: { MERGEFIELD Field1}
" "" }

Note the braces {} cannot be typed in from the keyboard. They have to be inserted by Word. They come in pairs. They are inserted when you add a merge field or a regular field. You can make your own fields with Ctrl-F9 which inserts a pair.
Reply With Quote
  #3  
Old 04-23-2012, 08:31 AM
peterock peterock is offline Advanced Question about Links to Excel Windows XP Advanced Question about Links to Excel Office 2007
Novice
Advanced Question about Links to Excel
 
Join Date: Apr 2012
Posts: 3
peterock is on a distinguished road
Default

How do I insert my previous link to exist as Field1?
Reply With Quote
  #4  
Old 04-23-2012, 09:41 AM
Charles Kenyon Charles Kenyon is offline Advanced Question about Links to Excel Windows Vista Advanced Question about Links to Excel Office 2010 32bit
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,140
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

Quote:
Originally Posted by peterock View Post
How do I insert my previous link to exist as Field1?
Sorry, I don't understand your question.

You may want to look at Mail Merge and the links from that page to better understand mail merge.
Reply With Quote
  #5  
Old 04-23-2012, 09:49 AM
Charles Kenyon Charles Kenyon is offline Advanced Question about Links to Excel Windows Vista Advanced Question about Links to Excel Office 2010 32bit
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,140
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

Quote:
Originally Posted by peterock View Post
How do I insert my previous link to exist as Field1?
OK, now I think I understand.

{ IF { LINK Excel.Sheet.8 "C:\\Documents and Settings\\*FAKE FOLDER\\FAKEFILE.xlsx" "Sheet1!R2C1:R2C3" \a \f 4 \r \* MERGEFORMAT } > 0 "Field1: { LINK Excel.Sheet.8 "C:\\Documents and Settings\\*FAKE FOLDER\\FAKEFILE.xlsx" "Sheet1!R2C1:R2C3" \a \f 4 \r \* MERGEFORMAT}
" "" }

Again, I think you would be better off using mail merge structure rather than link. The line above inserts your value from your spreadsheet if that value is greater than 0, together with an identifier "Field1: " here. It also inserts a new paragraph. If the value is blank or not greater than 0, it will not insert anything.
Reply With Quote
  #6  
Old 04-23-2012, 11:09 AM
peterock peterock is offline Advanced Question about Links to Excel Windows XP Advanced Question about Links to Excel Office 2007
Novice
Advanced Question about Links to Excel
 
Join Date: Apr 2012
Posts: 3
peterock is on a distinguished road
Default

Ok i tried it and I am getting "Error! Missing test condition." when I try to update it. Why is this happening? This is what it looks like so far.

{ IF { LINK Excel.Sheet.8 "C:\\Documents and Settings\\*FAKE FOLDER\\FAKEFILE.xlsx" "Sheet1!R2C1:R2C3" \a \f 4 \r \* MERGEFORMAT } > 0 "Field1: { LINK Excel.Sheet.8 "C:\\Documents and Settings\\*FAKE FOLDER\\FAKEFILE.xlsx" "Sheet2!R1C1:R4C4" \a \f 4 \r \* MERGEFORMAT }
" "" }
Reply With Quote
  #7  
Old 04-23-2012, 04:37 PM
macropod's Avatar
macropod macropod is offline Advanced Question about Links to Excel Windows 7 64bit Advanced Question about Links to Excel Office 2010 32bit
Administrator
 
Join Date: Dec 2010
Location: Canberra, Australia
Posts: 21,963
macropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond reputemacropod has a reputation beyond repute
Default

Hi Peter,

With the field code, you must have a space either side of the '0'. Spaces for the rest are inconsequential and your field code could be reduced to:
{IF{LINK Excel.Sheet.8 "C:\\Documents and Settings\\*FAKE FOLDER\\FAKEFILE.xlsx" "Sheet1!R2C1:R2C3" \a \f 4 \r}> 0 "Field1: {LINK Excel.Sheet.8 "C:\\Documents and Settings\\*FAKE FOLDER\\FAKEFILE.xlsx" "Sheet2!R1C1:R4C4" \a \f 4 \r}"}
__________________
Cheers,
Paul Edstein
[Fmr MS MVP - Word]
Reply With Quote
  #8  
Old 04-23-2012, 04:43 PM
Charles Kenyon Charles Kenyon is offline Advanced Question about Links to Excel Windows Vista Advanced Question about Links to Excel Office 2010 32bit
Moderator
 
Join Date: Mar 2012
Location: Sun Prairie, Wisconsin
Posts: 9,140
Charles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant futureCharles Kenyon has a brilliant future
Default

Try adding a set of quotation marks:

{ IF "{ LINK Excel.Sheet.8 "C:\\Documents and Settings\\*FAKE FOLDER\\FAKEFILE.xlsx" "Sheet1!R2C1:R2C3" \a \f 4 \r \* MERGEFORMAT }" > 0 "Field1: { LINK Excel.Sheet.8 "C:\\Documents and Settings\\*FAKE FOLDER\\FAKEFILE.xlsx" "Sheet2!R1C1:R4C4" \a \f 4 \r \* MERGEFORMAT }
" "" }


Otherwise, when I debug or build IF fields, I start out simple with only the IF field.
{ IF "test" = "test" "true" "false" } and make sure I get the expected result. Then step by step I substitute in what I want to use until I have a complete working IF field.
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
External/Embedded links to excel lucas Word 3 03-30-2012 01:47 PM
Edits links to Excel file in PowerPoint ziba PowerPoint 4 01-09-2012 08:48 AM
Powerpoint 2010 losing links to excel Hans_b PowerPoint 0 07-12-2011 04:19 AM
Updating Excel Chart Links fermat PowerPoint 0 07-09-2010 04:29 PM
Break Links with Excel streng Word 0 06-29-2009 02:43 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 04:09 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2024, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2024 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft