Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
DiscussionsAccessExcelInfoPathOutlookPowerPointPublisherWord
DirectoryUser Groups
Related Topics
Outlook ExpressInternet ExplorerWindowsMS Server ProductsMore Topics ...

MS Office Forum / Word / Programming / May 2006

Tip: Looking for answers? Try searching our database.

code for printing current section of a document

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
gils usenet acct - 14 May 2006 13:40 GMT
Hi All,

This discussion group has been like a good friend for years.  I really
appreciate y'all.  :)

I'd like code for printing the section the cursor is currently in.

How might I change the code below to accomplish this?

   Application.PrintOut FileName:="", Range:=wdPrintRangeOfPages, Item:= _
       wdPrintDocumentContent, Copies:=1, Pages:="s2",
PageType:=wdPrintAllPages _
       , Collate:=True, Background:=False, PrintToFile:=False,
PrintZoomColumn:= _
       0, PrintZoomRow:=0, PrintZoomPaperWidth:=0, PrintZoomPaperHeight:=0

tia,

Gil

Gil Carter, MD, JD, FP, medical programming

http://www.TenSecondMedicalRecord.com, in use since 1990, free since 1997

http://www.KeyChainEMR.com  Walk up to the medical ward computer, plug in,
do what you need, unplug and walk away.
Jay Freedman - 14 May 2006 16:04 GMT
Hi Gil,

The Selection.Information function can give you the current section
number, and you can use that to make a string to replace the "s2" in
your recorded macro. Also, you don't need all the default settings the
recorder insists on stuffing into the PrintOut statement. This will
do:

Dim PrintString As String
PrintString = "s" & _
   Selection.Information(wdActiveEndSectionNumber)
ActiveDocument.PrintOut Range:=wdPrintRangeOfPages, _
   Pages:=PrintString, Background:=False

--
Regards,
Jay Freedman
Microsoft Word MVP        FAQ: http://word.mvps.org
Email cannot be acknowledged; please post all follow-ups to the
newsgroup so all may benefit.

>Hi All,
>
[quoted text clipped - 22 lines]
>http://www.KeyChainEMR.com  Walk up to the medical ward computer, plug in,
>do what you need, unplug and walk away.
gils usenet acct - 14 May 2006 21:38 GMT
thank you Jay, ... worked like a char, :)  :)
Gil

> Hi Gil,
>
[quoted text clipped - 45 lines]
>>http://www.KeyChainEMR.com  Walk up to the medical ward computer, plug in,
>>do what you need, unplug and walk away.
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.