A Microsoft Office (Excel, Word) forum. OfficeFrustration

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

Go Back   Home » OfficeFrustration forum » Microsoft Word » Tables
Site Map Home Register Authors List Search Today's Posts Mark Forums Read  

copying a table without clipboard



 
 
Thread Tools Display Modes
  #1  
Old July 16th, 2008, 05:58 PM posted to microsoft.public.word.tables
HenryM679
external usenet poster
 
Posts: 4
Default copying a table without clipboard

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
  #2  
Old July 16th, 2008, 07:54 PM posted to microsoft.public.word.tables
Jay Freedman
external usenet poster
 
Posts: 9,488
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.


  #3  
Old July 16th, 2008, 08:29 PM posted to microsoft.public.word.tables
HenryM679
external usenet poster
 
Posts: 4
Default copying a table without clipboard

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.wdCollapse End)
rgDst.FormattedText = rgSrc.FormattedText

"Jay Freedman" wrote:

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.



  #4  
Old July 17th, 2008, 01:39 AM posted to microsoft.public.word.tables
Jay Freedman
external usenet poster
 
Posts: 9,488
Default copying a table without clipboard

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

On Wed, 16 Jul 2008 12:29:01 -0700, HenryM679
wrote:

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.wdCollapse End)
rgDst.FormattedText = rgSrc.FormattedText

"Jay Freedman" wrote:

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.
  #5  
Old July 17th, 2008, 02:32 PM posted to microsoft.public.word.tables
HenryM679
external usenet poster
 
Posts: 4
Default copying a table without clipboard

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.

"Jay Freedman" wrote:

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

On Wed, 16 Jul 2008 12:29:01 -0700, HenryM679
wrote:

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.wdCollapse End)
rgDst.FormattedText = rgSrc.FormattedText

"Jay Freedman" wrote:

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.

  #6  
Old July 17th, 2008, 05:59 PM posted to microsoft.public.word.tables
HenryM679
external usenet poster
 
Posts: 4
Default copying a table without clipboard

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.wdGoTo Bookmark,
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?

"Jay Freedman" wrote:

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

On Wed, 16 Jul 2008 12:29:01 -0700, HenryM679
wrote:

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.wdCollapse End)
rgDst.FormattedText = rgSrc.FormattedText

"Jay Freedman" wrote:

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.

 




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump


All times are GMT +1. The time now is 02:18 PM.


Powered by vBulletin® Version 3.6.4
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Copyright ©2004-2024 OfficeFrustration.
The comments are property of their posters.