Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Tables / July 2008

Tip: Looking for answers? Try searching our database.

copying a table without clipboard

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
HenryM679 - 16 Jul 2008 17:58 GMT
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
Jay Freedman - 16 Jul 2008 19:54 GMT
> 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

Signature

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.

HenryM679 - 16 Jul 2008 20:29 GMT
Thanks for your help but I still get a type mismatch error. I modified it
some to fit my app. It runs in ASP.net.

Here is what I have now.

     Dim rgSrc As Word.Range = wrdIn.ActiveDocument.Tables(7).Range
     wrdOut.Selection.MoveStart()
     wrdOut.Selection.Find.ClearFormatting()
     With wrdOut.Selection.Find
        .Text = "__ASSUMPTIONS__"
        .Replacement.Text = ""
        .Forward = True
        .Wrap = Word.WdFindWrap.wdFindStop
        .Format = False
        .MatchCase = True
        .MatchWholeWord = False
        .MatchWildcards = False
        .MatchSoundsLike = False
        .MatchAllWordForms = False
     End With
     wrdOut.Selection.Find.Execute()
     Dim rgDst As Word.Range
     rgDst = wrdOut.Selection.Range
     rgDst.Collapse(Word.WdCollapseDirection.wdCollapseEnd)
     rgDst.FormattedText = rgSrc.FormattedText

> > How can I copy a table from one doc to another doc without using the
> > clipboard?
[quoted text clipped - 17 lines]
>
> RgDest.FormattedText = RgSrc.FormattedText
Jay Freedman - 17 Jul 2008 01:39 GMT
I don't know ASP.Net syntax, so I probably can't help much. But in VBA, the Set
keyword is required when you try to assign a value to a Range object (or any
object), so the line third from the end should be

Set rgDst = wrdOut.Selection.Range

>Thanks for your help but I still get a type mismatch error. I modified it
>some to fit my app. It runs in ASP.net.
[quoted text clipped - 43 lines]
>>
>> 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.
HenryM679 - 17 Jul 2008 14:32 GMT
Thanks for your help. You gave me some new ideas.
Set is not used in .net. Visual Studio removes it if I put it in.

> I don't know ASP.Net syntax, so I probably can't help much. But in VBA, the Set
> keyword is required when you try to assign a value to a Range object (or any
[quoted text clipped - 55 lines]
> Microsoft Word MVP        FAQ: http://word.mvps.org
> Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit.
HenryM679 - 17 Jul 2008 17:59 GMT
I have tried all I can thing of and still get errors. Here is what I have now.

     Dim rgSrc As Word.Range = wrdIn.ActiveDocument.Tables(7).Range
     wrdOut.Selection.GoTo(What:=Word.WdGoToItem.wdGoToBookmark,
Name:="ASSUMPTIONS")
     wrdOut.Selection.InsertRows(rgSrc)

and I get this error

This method or property is not available because some or all of the object
does not refer to a table

Any ideas?

> I don't know ASP.Net syntax, so I probably can't help much. But in VBA, the Set
> keyword is required when you try to assign a value to a Range object (or any
[quoted text clipped - 55 lines]
> Microsoft Word MVP        FAQ: http://word.mvps.org
> Email cannot be acknowledged; please post all follow-ups to the newsgroup so all may benefit.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.