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.

--
Enjoy,
Tony

"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

try

r.Select
ActiveDocument.PrintOut Range:=wdPrintSelection

--
Enjoy,
Tony

"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.

--
Enjoy,
Tony

"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 OfficeKB.com" <u37563@uwe> wrote in message news:78de956c8dcec@xxxxxx
"could be used to print just the portion of the document between two
bookmarks"

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, _
End:=ActiveDocument.Bookmarks(strBM2).Start)
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 OfficeKB.com
http://www.officekb.com/Uwe/Forums.aspx/word-programming/200709/1










.



Relevant Pages

  • Re: Print a specific part of document
    ... 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 - which will be repaginated to start at the top of a page - then you must Select it first and then print the Selection. ... Sub PrintBetweenBookmarks(strBM1 As String, strBM2 As String) ...
    (microsoft.public.word.vba.general)
  • Re: Print a specific part of document
    ... "BruceM" wrote in message ... I don't know understand the distinction between range in the English sense and range in the VBA sense. ... You can print the Selection - or ranges of Pages or Sections. ... Sub PrintBetweenBookmarks ...
    (microsoft.public.word.vba.general)
  • Re: Identify current page
    ... BruceM wrote: ... object always refers to the active selection or insertion point. ... I don't understand what distinction you're making between "clicking into" a ...
    (microsoft.public.word.vba.general)
  • Re: combo box question
    ... Bruce and Ken ... "BruceM" wrote: ... > a record based on the combo box selection". ... >> name field changes. ...
    (microsoft.public.access.forms)