View Single Post
  #2   Report Post  
Posted to microsoft.public.word.tables
Jay Freedman Jay Freedman is offline
external usenet poster
 
Posts: 9,854
Default copying a table without clipboard

HenryM679 wrote:
How can I copy a table from one doc to another doc without using the
clipboard?

I need to make this app run on an website and possibly multiuser.

Thanks for any help


Declare two Range objects. Set the first one to the range of the existing
table, and set the second one to a collapsed point in the other document
where you want the copy. Then assign the .FormattedText property of the
second range to be equal to the .FormattedText property of the first range.
Something like this:

Dim RgSrc As Range, RgDest As Range

Set RgSrc = SrcDoc.Tables(1).Range

Set RgDest = DestDoc.Range
RgDest.Collapse wdCollapseEnd

RgDest.FormattedText = RgSrc.FormattedText

--
Regards,
Jay Freedman
Microsoft Word MVP FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the newsgroup so
all may benefit.