Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

powerpioint 2010 vba print current slide form a Qucik Access toolbar button

Status
Not open for further replies.

DougP

MIS
Dec 13, 1999
5,985
US
I have this code but it does not work since the code is in a Module. The error is
SlideshowWindows (unknown member): integer out of range. 1 is not in the valid range of 0-1
on yellow line below
How can I have a button on the "Quick access toolbar" point to code that is not dependent on which presentation is open?
I want to print the current slide by clicking a botton on the quick access toolbar.

TIA

Code:
  ' This code determines what slide is currently visible in the
   ' slide show and then it clears the print range and prints out the
   ' current slide.
   Sub PrintCurrentSlide()
   ' Declare lSldNum as a long integer.
   Dim lSldNum As Long
   ' Assign lSldNum to the current slide number.
   [highlight #FCE94F]lSldNum = SlideShowWindows(1).View.Slide.SlideNumber[/highlight]   ' Set the print options for the active presentation.
   With ActivePresentation.PrintOptions
      ' Set RangeType to print a slide range.
      .RangeType = ppPrintSlideRange
      ' Delete old print range settings.
      .Ranges.ClearAll
      ' Set Ranges to the new range for the current slide.
      .Ranges.Add lSldNum, lSldNum
   End With
   ActivePresentation.PrintOut
   End Sub
[/code

DougP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top