macro troubles: liink field in word

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 & i ...since the variable i 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

Control Word Wrap
Press Alt+Enter to move to a new row in a cell. Lets you control where the words wrap.

Forum statistics

Threads
1,224,527
Messages
6,179,345
Members
452,907
Latest member
Roland Deschain

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