WUGNET, the Windows User Group Network
Your Complete Resource Center for "The Best" in Shareware, Computing Tips and Support, Windows Industry News... and much more!
Home Forums Shareware Windows Tips Hot Offers FREE Newsletters Arcade Contact Us About Partners
Search WUGNET: RSS Feeds RSS Feeds Advertise with WUGNET    |    Shareware eBooks
HomeHome FAQFAQ   SearchSearch      ProfileProfile    Private MessagesPrivate Messages   Log in/Register/PasswordLog in/Register/Password

copying a table without clipboard

 
   Home -> Office -> Tables RSS
Next:  Tables: Table Row Headings - not on every page  
Author Message
HenryM679

External


Since: Jul 16, 2008
Posts: 4



(Msg. 1) Posted: Wed Jul 16, 2008 9:58 am
Post subject: copying a table without clipboard Add to elertz
Archived from groups: microsoft>public>word>tables (more info?)

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
Back to top
Login to vote
Jay Freedman

External


Since: Sep 16, 2003
Posts: 3588



(Msg. 2) Posted: Wed Jul 16, 2008 2:54 pm
Post subject: Re: copying a table without clipboard Add to elertz [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

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.
Back to top
Login to vote
HenryM679

External


Since: Jul 16, 2008
Posts: 4



(Msg. 3) Posted: Wed Jul 16, 2008 2:54 pm
Post subject: Re: copying a table without clipboard Add to elertz [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

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

"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.
>
>
>
Back to top
Login to vote
Jay Freedman

External


Since: Mar 17, 2004
Posts: 4378



(Msg. 4) Posted: Wed Jul 16, 2008 8:39 pm
Post subject: Re: copying a table without clipboard Add to elertz [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

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
<HenryM679 RemoveThis @discussions.microsoft.com> 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.wdCollapseEnd)
> 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.
Back to top
Login to vote
HenryM679

External


Since: Jul 16, 2008
Posts: 4



(Msg. 5) Posted: Thu Jul 17, 2008 6:32 am
Post subject: Re: copying a table without clipboard Add to elertz [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

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
> <HenryM679 DeleteThis @discussions.microsoft.com> 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.wdCollapseEnd)
> > 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.
>
Back to top
Login to vote
HenryM679

External


Since: Jul 16, 2008
Posts: 4



(Msg. 6) Posted: Thu Jul 17, 2008 9:59 am
Post subject: Re: copying a table without clipboard Add to elertz [Login to view extended thread Info.]
Archived from groups: per prev. post (more info?)

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?

"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
> <HenryM679.RemoveThis@discussions.microsoft.com> 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.wdCollapseEnd)
> > 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.
>
Back to top
Login to vote
Display posts from previous:   
       Home -> Office -> Tables All times are: Eastern Time (US & Canada) (change)
Page 1 of 1

 
You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
Categories:
 Windows XP
 Windows Vista
 Windows Other
  Office
 Office Other
 Security
 WinRAR
  • Home |
  • Shareware |
  • Windows Tips |
  • Hot Offers |
  • FREE Newsletters |
  • Arcade |
  • Forums |
  • eBooks |
  • About WUGNET |
  • Partners |
  • Contact

  • WUGNET Privacy Policy |
  • Link to WUGNET