View Single Post
  #6   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 doing what you said and that didn't seem to work. It wouldn't
accept the type:= Wapp.wdFieldEmpty so I replaced it with type:=
wdLinkTypeText. I tried several other versions and it still wouldn't
work. I was getting the same error. The other things I tried we
remove type argument, remove preserveformatting argument, remove both
type and preserveformatting argument, and remove range argument. The
last piece of code I tried was:

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

If you include the Type argument, then you have to leave out the word
LINK in the Text argument. If you set PreserveFormatting:=True, then you
should leave \* MergeFormat out of the Text argument.

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 :-)