View Single Post
 
Old 06-01-2016, 11:25 PM
DomiS DomiS is offline Windows 7 64bit Office 2010 64bit
Novice
 
Join Date: Apr 2016
Posts: 1
DomiS is on a distinguished road
Exclamation Copy and Paste a certain Page

Hey everyone,
I’m currently trying to program a command button so that after you have clicked on it, a certain page of your document will be copied and gets paste on a certain page of the document.
Currently my code looks something like this:
Private Sub CommandButton1_Click()
Dim Select As String

Select = InputBox("Which Page do you want to duplicate?", "Copy Page")
If Selection = vbNullString Then Exit Sub

Dim pRange As Range

Selection.GoTo What:=wdGoToPage, Which:=wdGoToNext, Name:=Select
Set pRange = ActiveDocument.Bookmarks("\Page").Range
pRange.Copy

ActiveDocument.Characters.Last.Select
Selection.Collapse

Selection.Paste
End Sub
This Code pastes the copied page on the last page which I have to insert before. What I want is that I can paste the page wherever I want (an upcoming massage Box would be good that asks me where I want to put it). My Word Document has about 26 pages if that is necessary to know.
Is there also a possibility to copy and paste the makros that are on the page together with their functions?
You see, I’m completely new here, so hopefully you can help me!
Regards,
Dominik
Reply With Quote