link field in a word table doesnt work

moshe28

New Member
Joined
Dec 25, 2007
Messages
10
Hi

I have a table in word, and run a macro that inserts link fields in each cell of the table where the link field is to cells in excel.

the code that i am running inside a word document is the following

Dim j As Integer
For j = 1 To 5


Selection.MoveRight Unit:=wdCell
Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, Text:= _
"LINK Excel.Sheet.8 ""t:\erase.xls"" ""erase!r1c1"" \a", PreserveFormatting:= _
False
Next j

this code works just fine and inserts from excel into my word table.......but if you will notice, it always used the cell "r1c1"

i want it to use the loop i created and use the cell r1c & j...since the variable j iterates each in the loop.......

but the quotes and double quotes in the link excel.sheet.8 is confusing me and i do not know how to deal get the macro to use r1&ci in the presence of all these quotes??

any ideas?
 

Excel Facts

Format cells as currency
Select range and press Ctrl+Shift+4 to format cells as currency. (Shift 4 is the $ sign).
Not tested but compiles OK:

Code:
        Selection.Fields.Add Range:=Selection.Range, Type:=wdFieldEmpty, Text:= _
            "LINK Excel.Sheet.8 ""t:\erase.xls"" ""erase!r1c" & j & """ \a", PreserveFormatting:= _
            False
 
Upvote 0

Forum statistics

Threads
1,224,518
Messages
6,179,248
Members
452,900
Latest member
LisaGo

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top