MS Word Macro to print multiple pages of single doc

Kim B

Board Regular
Joined
Jun 16, 2008
Messages
233
Office Version
  1. 365
Hi everyone. This macro is meant to work in a word doc except it doesn't work. It is supposed to allow the user to print multiple copies of a single word document with a page number designation at the bottom of page to the right. In the lower rigth corner of word doc is bookmark named {Order}.

I am getting an error on ActiveDocument.Bookmarks line. Any suggestions?

Sub AutoNew()
Order = System.PrivateProfileString("C:\Settings.Txt", _
"MacroSettings", "Order")
If Order = "" Then
Order = 1
Else
Order = Order + 1
End If
System.PrivateProfileString("C:\Settings.txt", "MacroSettings", _
"Order") = Order
ActiveDocument.Bookmarks("Order").Range.InsertBefore Format(Order, "1#")
ActiveDocument.SaveAs FileName:="path" & Format(Order, "1#")
End Sub
 

Excel Facts

Convert text numbers to real numbers
Select a column containing text numbers. Press Alt+D E F to quickly convert text to numbers. Faster than "Convert to Number"
Hi Kim,
I am getting an error on ActiveDocument.Bookmarks line.
It would be helpful if you shared what the error message says.

For example, if the message is:
Runtime error '5941':

The requested member of the collection does not exist
that means the 'Order' bookmark is missing from the document.
 
Upvote 0
Sorry it took so long to respond to this post.

That is the error I am getting too.
 
Upvote 0
Hi Kim,

As I said:
that means the 'Order' bookmark is missing from the document.
The solution is simple: re-insert the 'Order' bookmark into the document wherever it should be.
 
Upvote 0
My apologies for the duplication in the response, didn't see the solution the first time. Just paid attention to the message in the box.
 
Upvote 0

Forum statistics

Threads
1,225,531
Messages
6,185,483
Members
453,297
Latest member
alvintranvcu123

We've detected that you are using an adblocker.

We have a great community of people providing Excel help here, but the hosting costs are enormous. You can help keep this site running by allowing ads on MrExcel.com.
Allow Ads at MrExcel

Which adblocker are you using?

Disable AdBlock

Follow these easy steps to disable AdBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the icon in the browser’s toolbar.
2)Click on the "Pause on this site" option.
Go back

Disable AdBlock Plus

Follow these easy steps to disable AdBlock Plus

1)Click on the icon in the browser’s toolbar.
2)Click on the toggle to disable it for "mrexcel.com".
Go back

Disable uBlock Origin

Follow these easy steps to disable uBlock Origin

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back

Disable uBlock

Follow these easy steps to disable uBlock

1)Click on the icon in the browser’s toolbar.
2)Click on the "Power" button.
3)Click on the "Refresh" button.
Go back
Back
Top