Save Active Slide

jerry
NewLounger
Posts: 12
Joined: 29 Jul 2010, 06:16

Save Active Slide

Post by jerry »

Hi, Guys

A a very quick question I was trying to get this powerpoint running and im having some labour intensive coding and i was curious is it quicker to do it another way

I want to save my powerpoint slide with changes as a jpg in a directory
however i have at least 500+ slides so i have a macro that says save active slide but its intense telling it what slide to save on

is there an easier way

heres the code anyways im sorry if i sound confusing

where it says active slide 3 can it be dynamic so i dont have to type it in

Code: Select all


Private Sub CommandButton3_Click()

    '1) Brings up an input box that says "Change Project Scope"
    '2) Creates a small text box, with size 14 black font, in the lower right-hand corner of the Active Slide with the value entered into the input box.
    
    Dim objSlide As Slide
    
    '---------------------------------------------
    '   User Variables
    '---------------------------------------------
    intFontSize = 14
    strFontName = "Arial"
    intFontColor = vbBlack
    
    'This is for minor adjustment of textbox position
    intMargin = 20
    '---------------------------------------------
    

    strProjectNumber = InputBox("Change the Scope of the Project", "Scope Change")
    If strProjectNumber = "" Then Exit Sub
    
          
    ' Get the slide height and width.
    intSlideHeight = ActivePresentation.PageSetup.SlideHeight
    intSlideWidth = ActivePresentation.PageSetup.SlideWidth
    
    Set myDocument = ActivePresentation.Slides(3)
    
    'For Each objSlide In ActivePresentation.Slides
    
        With ActivePresentation.Slides(3).Shapes.AddTextbox(msoTextOrientationHorizontal, 0, 0, 200, 200)
            .Name = "MyTextBox"
            .TextFrame.WordWrap = msoTrue
            With .TextFrame.TextRange
                .Text = strProjectNumber
                With .Font
                    .Name = strFontName
                    .Size = intFontSize
                    .Color = intFontColor
                End With
                intTextBoxWidth = .BoundWidth
                intTextBoxHeight = .BoundHeight
            End With
            .Left = intSlideWidth - intTextBoxWidth - intMargin
            .Top = intSlideHeight - intTextBoxHeight - intMargin
        End With
        
    'Next
    
    Dim SlideIndex As Long
 
SlideIndex = (ActivePresentation.SlideShowWindow.View.Slide.SlideIndex) + 1
 
FileName = "Jennings_" & CStr(SlideIndex) & ".JPG"
    
With Application.ActivePresentation.Slides(3)
    .Export "H:\powerpoint\New00 Designs\CHANGES\" & _
        "Slide 3 of A15.jpg", "JPG"


        End With
        

        
End Sub

User avatar
StuartR
Administrator
Posts: 12604
Joined: 16 Jan 2010, 15:49
Location: London, Europe

Re: Save Active Slide

Post by StuartR »

You could try replacing

Code: Select all

With Application.ActivePresentation.Slides(3)
    .Export "H:\powerpoint\New00 Designs\CHANGES\" & _
        "Slide 3 of A15.jpg", "JPG"


        End With
with something like

Code: Select all

For i = 1 to Application.ActivePresentation.Slides.Count
    With Application.ActivePresentation.Slides(i)
        .Export "H:\powerpoint\New00 Designs\CHANGES\" & _
            "Slide " & STR(i) & " of A15.jpg", "JPG"
    End With
Next i
You would also need to add

Code: Select all

Dim i as integer
near the beginning of the code.
StuartR


jerry
NewLounger
Posts: 12
Joined: 29 Jul 2010, 06:16

Re: Save Active Slide

Post by jerry »

thanks so much stuart that helped

although now its saving every slide as a jpg before continuing is it possible only to take a snapshot of the current slide only and then moving on

sorry to be painful

User avatar
StuartR
Administrator
Posts: 12604
Joined: 16 Jan 2010, 15:49
Location: London, Europe

Re: Save Active Slide

Post by StuartR »

jerry,

I don't quite understand what you want to do. Can you please try to explain exactly what should happen and I will try to help you.
StuartR


jerry
NewLounger
Posts: 12
Joined: 29 Jul 2010, 06:16

Re: Save Active Slide

Post by jerry »

Hey again stuart

sorry about the weird reply early hours and my brain wasnt switched on


okay so basically what happens is that where i work we do alot of engineering designs and what happens is when a project is finished we review with microsoft powerpoint so that we get to see alot more detail on a bigger screen
with powerpoint we have all the drawings as an image and while the slide show is on a small command button is visible and that brings up the message box where we write what we would like to change about this design
and it creates a text box with the whatever we have just typed
once that has been completed we then save that specific slide as a jpeg in a directory and after we have finished a project meeting we simply goto the directory called changes and only the specific changed projects are listed as a jpeg snapshot however as you can see in the code i am using active slide and nominating the slide number
the task of naming every active slide is labour intensive as we have hundreds of drawings,

so when the command button is created i then copy the code and have to change the active slide number again quite intensive

so im a newbie at all of this and happily accept any help

again tahnks for your help stuart

User avatar
StuartR
Administrator
Posts: 12604
Joined: 16 Jan 2010, 15:49
Location: London, Europe

Re: Save Active Slide

Post by StuartR »

Jerry,

Thanks for the clear explanation.

When you are editing a PowerPoint presentation, the slide that is currently being edited is
Windows(1).Selection.SlideRange(1).SlideIndex

So you could define an integer variable, and then set it to the current slide using

Code: Select all

Dim iActiveSlide as Integer
...
iActiveSlide = Windows(1).Selection.SlideRange(1).SlideIndex
...
Application.ActivePresentation.Slides(iActiveSlide).Export _
    "H:\powerpoint\New00 Designs\CHANGES\Slide " & Str(iActiveSlide) & " of A15.jpg", "JPG"
StuartR


jerry
NewLounger
Posts: 12
Joined: 29 Jul 2010, 06:16

Re: Save Active Slide

Post by jerry »

Stuart

Sorry About the late reply

but it works beautifully many beers are presented to you if you are in sydney

many thanks again