Visual Basic Help need please !

  boot-it-out 08:42 15 Nov 04
Locked

Powerpoint ( 2002 ) project :

I want to click on an object / Text box in my slide show that will then print that slide. There are LOTS of slides and I want the same feature on each one.

I have tried recording a Macro ( a subject I know very little about ) as follows - this was done with Slide 1 displayed :

Sub PrintSlide()
'
' Macro recorded 15/11/2004 by Alan
'

With ActivePresentation.PrintOptions
.RangeType = ppPrintCurrent
.NumberOfCopies = 1
.Collate = msoTrue
.OutputType = ppPrintOutputSlides
.PrintHiddenSlides = msoTrue
.PrintColorType = ppPrintBlackAndWhite
.FitToPage = msoFalse
.FrameSlides = msoFalse
.ActivePrinter = "Canon LBP-800"
End With
ActivePresentation.PrintOut
End Sub

I have assigned the Macro using Action settings for my object and it works for Slide 1 - The problem is that if I then use the same Macro on Slide 2 or 3 etc, it only prints the 1st slide that was displayed when the Macro was recorded!

How do I set it up to be able to use the same Macro on different pages, without having to record a saperate Macro for each page ???

I've tried wallowing through the Basic Help files but don't really understand them !

Cheers,

Alan M

  cherria 11:56 15 Nov 04

I guess you are providing them with a button on each slide linked to this macro so that when in the slideshow, they can click a button and print the page that they are on?

If so, then the problem is that the current slide refers to teh slide that you are on outside the slideshow so wherever you are in the slide show, current slide remains the same.

The code that I think you need instead print a slide range and the range is determined by the slide that you are on in the slideshow


Sub Macro1()
'
' Macro recorded 15/11/2004 by Andrew Cherriman
'

With ActivePresentation.PrintOptions
.RangeType = ppPrintSlideRange
With .Ranges
.ClearAll
.Add Start:=SlideShowWindows(Index:=1).View.Slide.SlideIndex, End:=SlideShowWindows(Index:=1).View.Slide.SlideIndex
End With
.NumberOfCopies = 1
.Collate = msoTrue
.OutputType = ppPrintOutputSlides
.PrintHiddenSlides = msoTrue
.PrintColorType = ppPrintBlackAndWhite
.FitToPage = msoFalse
.FrameSlides = msoFalse
.ActivePrinter = "HP LaserJet 5M"
End With
ActivePresentation.PrintOut
End Sub


Hope this helps, sorry about the (probably) wierd formatting

  boot-it-out 13:23 15 Nov 04

You're a star - now working perfectly - Many Thanks !

This thread is now locked and can not be replied to.

Huawei P10 review

1995-2015: How technology has changed the world in 20 years

An overview: What leading creative agencies are doing to improve diversity

New iPad, iPhone SE & Red iPhone 7 on sale now