从源文档切割和粘贴到目标文档 [英] Cutting and Pasting from a source doc to a target doc

查看:56
本文介绍了从源文档切割和粘贴到目标文档的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我正在尝试将一个

文档中的不同段落剪切并粘贴到另一个文档中。在主文档中,我将
放入复选框,执行一些代码以将

信息复制并粘贴到另一个文档中。我遇到了麻烦

将光标移动到目标文件

的第一个选择的末尾。当我从主文档中选择第二个

段落时,它会从第一个选项中复制




如何当我想粘贴数据时,我确保光标始终位于

的最后一个选项的末尾吗?


任何帮助都会很棒..


-Buster

解决方案

您使用的是Word文档吗?你需要发布一些代码。


" Buster" < JM ******** @ yahoo.com>在消息中写道

news:01 **************************** @ phx.gbl ... < blockquote class =post_quotes>

我正在尝试将一个
文档中的不同段落剪切并粘贴到另一个文档中。在主文档中,我放置了一些代码来复制并将
信息粘贴到另一个文档中。我无法将光标移动到目标文档中第一个选择的末尾。当我从主文档中选择第二段时,它会从第一个选项中复制


如何确保光标始终位于
我想粘贴数据时的最后选择?

任何帮助都会很棒..

-Buster



这是代码。


私有子PARA1_Click()


如果PARA1.Value = -1然后

ActiveDocument.Paragraphs(1).Range.Copy

Documents.Add

ActiveDocument.SaveAs FileName:=" C:\文件和

设置\ jmielke \Desktop \REPORT.doc"

ActiveDocument.Range.Paste

Selection.MoveDown单位:= wdParagraph,伯爵:= 1


使用ActiveDocument.Content

.InsertParagraphAfter

。插入Chr(10)

结束


Selection.MoveDown单位:= wdLine,计数:= 1


ActiveDocument.Save


文件(" test.doc")。激活


否则

结束如果


结束子


私人子PARA2_Click()


如果PARA2.Value = -1那么


ActiveDocument.Paragraphs(3).Range.Copy

Documents(" REPORT.doc")。激活

Selection.MoveDown单位:= wdParagraph,计数:= 2

ActiveDocument.Range.Paste

ActiveDocument.Save


文件(" test.doc" ).Activate

Else

''MsgBox"未选中复选框

结束如果


结束子

私人子PARA3()


结束子

- ----原帖-----
您好,

我正在尝试将
onedocument中的不同段落剪切并粘贴到另一个文档中。在主文档中,我放置了一些代码来复制并将
信息粘贴到另一个文档中。我遇到了麻烦
将光标指向目标文档中第一个选择
的末尾。当我从主文档中选择第二个段落时,它会复制第一个选择的
行。

如何确保光标始终位于<当我想要粘贴数据时,最后一个选择是什么?

任何帮助都会很棒..

-Buster



嗨巴斯特,


在要粘贴的位置插入书签。

当你选择那个书签时返回然后:


oDoc.Content.Bookmarks.Item(" test")。选择()


oDoc.Content.Application .Selection.MoveRight(单位:= CInt(Word.WdUnits.wdChara

cter),计数:= 2)

''做你的粘贴

让我知道这是否有帮助。


" Buster" < JM ******** @ yahoo.com>在消息中写道

news:01 **************************** @ phx.gbl ... < blockquote class =post_quotes>

我正在尝试将一个
文档中的不同段落剪切并粘贴到另一个文档中。在主文档中,我放置了一些代码来复制并将
信息粘贴到另一个文档中。我无法将光标移动到目标文档中第一个选择的末尾。当我从主文档中选择第二段时,它会从第一个选项中复制


如何确保光标始终位于
我想粘贴数据时的最后选择?

任何帮助都会很棒..

-Buster



Hi,

I am trying to cut and paste different paragraphs from one
document into another document. In the main document, I
put check boxes that do some code to copy and paste the
information into another document. I am having trouble
nagigating the cursor to the end of the first selection in
the destination document. When I choose the second
paragraph from the main document, it copies over the lines
from the first selection.

How do I ensure that the cursor is always at the end of
the last selection when I want to paste the data?

Any help would be great..

-Buster

解决方案

Are you using Word documents? You need to post some code.

"Buster" <jm********@yahoo.com> wrote in message
news:01****************************@phx.gbl...

Hi,

I am trying to cut and paste different paragraphs from one
document into another document. In the main document, I
put check boxes that do some code to copy and paste the
information into another document. I am having trouble
nagigating the cursor to the end of the first selection in
the destination document. When I choose the second
paragraph from the main document, it copies over the lines
from the first selection.

How do I ensure that the cursor is always at the end of
the last selection when I want to paste the data?

Any help would be great..

-Buster



Here is the code.

Private Sub PARA1_Click()

If PARA1.Value = -1 Then
ActiveDocument.Paragraphs(1).Range.Copy
Documents.Add
ActiveDocument.SaveAs FileName:="C:\Documents and
Settings\jmielke\Desktop\REPORT.doc"
ActiveDocument.Range.Paste
Selection.MoveDown Unit:=wdParagraph, Count:=1

With ActiveDocument.Content
.InsertParagraphAfter
.InsertAfter Chr(10)
End With

Selection.MoveDown Unit:=wdLine, Count:=1

ActiveDocument.Save

Documents("test.doc").Activate

Else
End If

End Sub

Private Sub PARA2_Click()

If PARA2.Value = -1 Then

ActiveDocument.Paragraphs(3).Range.Copy
Documents("REPORT.doc").Activate
Selection.MoveDown Unit:=wdParagraph, Count:=2
ActiveDocument.Range.Paste
ActiveDocument.Save

Documents("test.doc").Activate
Else
'' MsgBox "The Check box is not checked"
End If

End Sub
Private Sub PARA3()

End Sub

-----Original Message-----
Hi,

I am trying to cut and paste different paragraphs from onedocument into another document. In the main document, I
put check boxes that do some code to copy and paste the
information into another document. I am having trouble
nagigating the cursor to the end of the first selection inthe destination document. When I choose the second
paragraph from the main document, it copies over the linesfrom the first selection.

How do I ensure that the cursor is always at the end of
the last selection when I want to paste the data?

Any help would be great..

-Buster
.



Hi Buster,

Insert a bookmark where you want to paste.
Select that bookmark when you return and then:

oDoc.Content.Bookmarks.Item("test").Select()

oDoc.Content.Application.Selection.MoveRight(Unit: =CInt(Word.WdUnits.wdChara
cter), count:=2)
''do your paste
Let me know if this helps.


"Buster" <jm********@yahoo.com> wrote in message
news:01****************************@phx.gbl...

Hi,

I am trying to cut and paste different paragraphs from one
document into another document. In the main document, I
put check boxes that do some code to copy and paste the
information into another document. I am having trouble
nagigating the cursor to the end of the first selection in
the destination document. When I choose the second
paragraph from the main document, it copies over the lines
from the first selection.

How do I ensure that the cursor is always at the end of
the last selection when I want to paste the data?

Any help would be great..

-Buster



这篇关于从源文档切割和粘贴到目标文档的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆