Re: Print a specific part of document

I don't think there's anything you can do about that. They don't print when you print the Selection.


"BruceM" <bamoob@xxxxxxxxxxxxxxxx> wrote in message news:%23kFClxCBIHA.3848@xxxxxxxxxxxxxxxxxxxxxxx
Another question is about how to include the header and footer information in what I print out. When I select the range the header and footer are not included. How can I include those?

"Tony Jollans" <My forename at my surname dot com> wrote in message news:eGbgdCgAIHA.536@xxxxxxxxxxxxxxxxxxxxxxx
Given so many variables, the only sure way is the Selection so, instead of

ActiveDocument.PrintOut Range:=r


ActiveDocument.PrintOut Range:=wdPrintSelection


"BruceM" <bamoob@xxxxxxxxxxxxxxxx> wrote in message news:Oms2X0fAIHA.4956@xxxxxxxxxxxxxxxxxxxxxxx
I don't know how to select a section or range. That is a big part of the problem. I always need to select some number of pages, but sometimes it is all of the pages, sometimes the first one only, sometimes the fifth and sixth pages, and so forth. If I use sections I expect I would need it to be the same section number in order to use the same code for all documents, but I have no control over how the author arranges that.
Also, I don't know understand the distinction between range in the English sense and range in the VBA sense. I want to put a markers into a document and have Word print everything between the markers.

"Tony Jollans" <My forename at my surname dot com> wrote in message news:ees%23HCfAIHA.1208@xxxxxxxxxxxxxxxxxxxxxxx
You can't do that.

You can print the Selection - or ranges (in the English sense of the word) of Pages or Sections.

If you really want to print a Range (in the Word VBA sense of the word) - which will be repaginated to start at the top of a page - then you must Select it first and then print the Selection.


"BruceM" <bamoob@xxxxxxxxxxxxxxxx> wrote in message news:usX$V6cAIHA.4476@xxxxxxxxxxxxxxxxxxxxxxx
I have been trying to get the macro to work, but I get Error 13 (type mismatch) on the line:
ActiveDocument.PrintOut Range:=r

I set a watch, and it seems the range is being defined correctly (although I am not very familiar with VBA for Word), but that line of code has me stumped. I tried to do some research, but there is no documentation in Help for the PrintOut method, nor for ActiveDocument or Range. The MS web site is similarly unenlightening.

Assuming I can resolve the type mismatch, can I put this code into an Add In, and set up the Word installation from which this will be printed with that Add In, rather than adding the macro individually to several hundred documents? I realize there is some work to do adding bookmarks to all of the documents, but so much the better if I don't need to add the macro over and over too.

"fumei via" <u37563@uwe> wrote in message news:78de956c8dcec@xxxxxx
"could be used to print just the portion of the document between two

Yes, absolutely. Say you have two bookmarks, "Yabba", and "DaBaDoo":

Sub PrintBetweenBookmarks(strBM1 As String, strBM2 As String)
Dim r As Range
Set r = ActiveDocument.Range( _
Start:=ActiveDocument.Bookmarks(strBM1).End, _
ActiveDocument.PrintOut Range:=r
Set r = Nothing
End Sub

Sub DoIt()
Call PrintBetweenBookmarks("Yabba", "DaBaDoo")
End Sub

will print from the END of Yabba, to the START of DaBaDoo.

Message posted via