Microsoft Office Forums

Go Back   Microsoft Office Forums > >

Reply
 
Thread Tools Display Modes
  #1  
Old 09-12-2025, 11:10 PM
19119 19119 is offline duplicate macro keeps giving syntax error Mac OS X duplicate macro keeps giving syntax error Office 2016 for Mac
Novice
duplicate macro keeps giving syntax error
 
Join Date: Sep 2025
Posts: 4
19119 is on a distinguished road
Default duplicate macro keeps giving syntax error

Hello,
I know nothing about coding but last time I needed to duplicate a whole page in Word, this worked for me:

Sub Duplicate()

Page = InputBox(“Enter the Page to Duplicate”)

Count = InputBox(“Enter Number of times to duplicate”)

With Selection



.GoTo wdGoToPage, wdGoToAbsolute, Page

.Bookmarks(“ \ Page”).Range.Copy

For i = 1 To Count: .Paste: Next

End With

End Sub

Right now, it's not working and keeps giving me the "syntax error" notification. The only difference is that last time, the document had multiple pages already and I was duplicating one page even more times. This time, the document just has one page which I have to duplicate into 60 pages.
Reply With Quote
  #2  
Old 09-13-2025, 01:22 AM
maniek maniek is offline duplicate macro keeps giving syntax error Windows 10 duplicate macro keeps giving syntax error Office 2007
Novice
 
Join Date: Dec 2014
Posts: 4
maniek is on a distinguished road
Default

This works for me
Sub DuplMultPg()
'https://www.msofficeforums.com/word-vba/53764-duplicate-macro-keeps-giving-syntax-error.html
Dim Pg As Long, Count As Long, i As Long
Pg = InputBox("Enter the Page to Duplicate")
Count = InputBox("Enter Number of times to duplicate")
With Selection
.GoTo wdGoToPage, wdGoToAbsolute, Pg
.Bookmarks("\Page").Range.Copy
For i = 1 To Count: .Paste: Next
End With
End Sub
Attached Files
File Type: txt DuplMultPg.txt (466 Bytes, 3 views)
Reply With Quote
  #3  
Old 09-13-2025, 10:16 PM
19119 19119 is offline duplicate macro keeps giving syntax error Mac OS X duplicate macro keeps giving syntax error Office 2016 for Mac
Novice
duplicate macro keeps giving syntax error
 
Join Date: Sep 2025
Posts: 4
19119 is on a distinguished road
Default It worked!

Thank you so much!
Reply With Quote
  #4  
Old 09-13-2025, 11:44 PM
19119 19119 is offline duplicate macro keeps giving syntax error Mac OS X duplicate macro keeps giving syntax error Office 2016 for Mac
Novice
duplicate macro keeps giving syntax error
 
Join Date: Sep 2025
Posts: 4
19119 is on a distinguished road
Default

Thank you, I thought it worked but in the duplicated pages, the image is not placed where it's supposed to be. Fyi, the image is "Behind Text".

Quote:
Originally Posted by maniek View Post
This works for me
Sub DuplMultPg()
'https://www.msofficeforums.com/word-vba/53764-duplicate-macro-keeps-giving-syntax-error.html
Dim Pg As Long, Count As Long, i As Long
Pg = InputBox("Enter the Page to Duplicate")
Count = InputBox("Enter Number of times to duplicate")
With Selection
.GoTo wdGoToPage, wdGoToAbsolute, Pg
.Bookmarks("\Page").Range.Copy
For i = 1 To Count: .Paste: Next
End With
End Sub
Reply With Quote
  #5  
Old 09-14-2025, 01:19 AM
19119 19119 is offline duplicate macro keeps giving syntax error Mac OS X duplicate macro keeps giving syntax error Office 2016 for Mac
Novice
duplicate macro keeps giving syntax error
 
Join Date: Sep 2025
Posts: 4
19119 is on a distinguished road
Default

Thank you, I thought it worked but in the duplicated pages, the image is not placed where it's supposed to be. Fyi, the image is "Behind Text".
Reply With Quote
Reply



Similar Threads
Thread Thread Starter Forum Replies Last Post
Syntax Error in computed field newcomer@flounder.com Word 6 09-19-2023 08:41 AM
Error handling in formula - suppress 'Syntax Error' Cosmo Word 7 02-24-2014 07:08 AM
Using multiple formulas in one (IF, AND and SUM) gives syntax error markdeniet Word 1 02-05-2014 05:17 AM
duplicate macro keeps giving syntax error Underline word with error witthout giving a suggestion for correcting... sauerlu Word 1 01-29-2014 11:15 AM
duplicate macro keeps giving syntax error VLookup is giving me #N/A error, help with data or formula? ladygogo78 Excel 3 10-22-2012 12:28 AM

Other Forums: Access Forums

All times are GMT -7. The time now is 02:51 AM.


Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2025, vBulletin Solutions Inc.
Search Engine Optimisation provided by DragonByte SEO (Lite) - vBulletin Mods & Addons Copyright © 2025 DragonByte Technologies Ltd.
MSOfficeForums.com is not affiliated with Microsoft