View Single Post
  #4   Report Post  
Posted to microsoft.public.word.vba.general,microsoft.public.excel.programming,microsoft.public.excel.misc,microsoft.public.word.vba.userforms
Cindy M. Cindy M. is offline
external usenet poster
 
Posts: 21
Default Link table from excel to word using word VBA

I tried writing code to add \*MERGEFORMAT with the previous VBA syntex
you wrote me, but it would not work. I kept getting a run-time error
'450': wrong number of arguments or invalid property assignment. I get
this error even when I change rng to Wdoc.Application.Selection, where
Wdoc = Wapp.ActiveDocument. Or when I add preserveformat = true. This
is the code I wrote:

rng.Fields.Add Range:=Selection.Range, Type:=xlWorksheet, _
Text:="LINK Excel.Sheet.8 C:\\Documents and
Settings\\shornbec\\Desktop\\sarah\\excel
templates\\Mission.FY07Q1_Sarah.xls MissionTimelineDeltaVBudgetTable \a
\f 4 \h \*MERGEFORMAT"

The Type argument is wrong; you don't need it since the LINK field name
is specified in the text. Remove it completely or use wdApp.wdFieldEmpty
(where wdApp is whatever variable name you're using for the
Word.Application). And put a space between \* and Mergeformat. You'll
probably also need to put the path in 'single quotes' since it contains
spaces.

Cindy Meister
INTER-Solutions, Switzerland
http://homepage.swissonline.ch/cindymeister (last update Jun 17 2005)
http://www.word.mvps.org

This reply is posted in the Newsgroup; please post any follow question or
reply in the newsgroup and not by e-mail :-)