I am currently preparing a "final report" document in Powerpoint that requires me not to include animations. However, the various source documents to be combined include animations.
I am searching for a way to automatically generate a slide for each animation step. Basically the same functionality as exporting the slides to PDF with animation steps, with the difference that the animation steps remain powerpoint slides.
Is there a way to achieve this automatically, or do I have to duplicate the slides and prepare the animation steps myself?
Use the PPspliT add-in for MS Office by a man named Massimo Rimondini. It does exactly what you want. I checked in Office 2013 and it works fine.
Bonus:
In case that plugin fails to remove all the animations and convert into separate slides (which is very unlikely), you can disable any remaining animations for slide show, or remove them altogether using a macro.
Disabling animations:
You can turn off the animations by going to "Setup Slide Show" and under "Show Options" tick the "Show without animation" option and click OK. Now run the show and it will display without the animations.
Removing animations altogether:
If you really want to delete all the animations in a single sweep then you will need to run this macro.
Sub StripAllBuilds()
Dim I As Integer: Dim J As Integer
Dim oActivePres As Object
Set oActivePres = ActivePresentation
With oActivePres
For I = 1 To .Slides.Count
If Val(Application.Version) < 10 Then
' Older versions of PowerPoint 97/2000
' In each slide set the animation property
' of the Shape object to FALSE
For J = 1 To .Slides(I).Shapes.Count
.Slides(I).Shapes(J).AnimationSettings.Animate = msoFalse
Next J
Else
' New versions support the Timeline object
For J = .Slides(I).TimeLine.MainSequence.Count To 1 Step -1
.Slides(I).TimeLine.MainSequence(J).Delete
Next J
End If
Next I
End With
Set oActivePres = Nothing
End Sub
Related
I'm wondering if Powerpoint has a feature where I can automatically add a formatted header to each slide that displays the section and/or chapter. I'm presenting my thesis, and it is divided into sections, like "method" or "evaluation", and I would love it if I could automatically display that in the header of each slide. Preferrably, this would be automatically fetched from my powerpoint sections.
I want this look, which I'm currently producing manually for each slide.
Here's a bit of starter code to get you the name of the section each slide belongs to.
Over to you to provide the code to add the text to each slide and position/format it.
Sub Test()
Dim oSl As Slide
' Make sure there ARE sections
If ActivePresentation.SectionProperties.Count > 0 Then
For Each oSl In ActivePresentation.Slides
Debug.Print GetSection(oSl)
Next
End If
End Sub
Function GetSection(oSl As Slide) As String
' Returns the name of the section that this slide belongs to.
With oSl
Debug.Print .sectionIndex
GetSection = ActivePresentation.SectionProperties.Name(.sectionIndex)
End With
PowerPoint has no function like this built-in.
However, like most Office products, PowerPoint does have a very powerful VBA macro engine, which would certainly be capable of doing this.
Your macro would have to capture the Section name based on whatever parameters you choose to use to mark that, and then it could place that information anywhere you please within subsequent slides.
Because slides are more about visual layout than programmatic auto-creation, this is something you'd have to build yourself.
I am new to VB6 and am working on some code for a business (cattle auction). They are wanting a progress to show on their main page the percent that is left in the sale. the progress bar would be based on (Total head remaining / total head checked In)
I have tried finding information on how to make this work in old forums and on Youtube but since VB6 is so old i'm not finding useful information.
All the videos I have watched and forums I have read show the progress bar moving based on a timer or button. I am needing it to move based on other information entered ( if that makes sense ).
VB6 ProgressBar documentation can be found here: https://learn.microsoft.com/en-us/previous-versions/visualstudio/visual-basic-6/aa443485(v%3dvs.60)
The ProgressBar is in the common controls library, so you'll need to select Microsoft Windows Common Controls 6.0 in the Toolbox Components list before it will be available in the Toolbox.
I prefer setting the Scrolling property to smooth scrolling.
Using it is easy, a simplest sample using your descriptions could have a HeadsToSell textbox, a StartAuction button, and a CowSold button. Clicking the StartAuction button sets the ProgressBar Max property to the number of heads, then for every head that is sold, clicking the CowSold button decrements the number of available head and updates the ProgressBar value.
Option Explicit
Private CurrentHeadCound As Integer
Private Sub CowSold_Click()
CurrentHeadCound = CurrentHeadCound - 1
ProgressBar1.Value = CurrentHeadCound
End Sub
Private Sub StartAuction_Click()
ProgressBar1.Max = HeadsToSell.Text
ProgressBar1.Value = ProgressBar1.Max
CurrentHeadCound = ProgressBar1.Max
End Sub
I'm making a program in vb6 that requires me to be able to scroll a certain area of the screen to the right. It consists solely of lines and picture boxes, is there a way to only scroll that area? Thanks!
You can take advantage from the fact that some visual controls can act as container of other visual controls.
Just an example:
In the VBIDE, place a Frame over a VB Form. Then - inside this Frame place a PictureBox. Pay attention that the PictureBox shall be fully contained inside this Frame.
Now, if you drag the Frame around the Form, you will see that the PictureBox inside is moving together, while keeping the position inside the container Frame, i.e. it will keep the original top & left coordinates relative to the container control.
To find out which visual controls have this capability, simply retry the test. You will see, for example, that a Label can't act as a container.
That said, you need following:
one visual control (preferably a PictureBox) which act as container (the viewport)
one visual control (preferably a PictureBox) which act as scrollable area
a HScrollBar (and, optionally, a VScrollBar) to scroll the
view-able area
Now, inside the second PictureBox (the scrollable area) you can place your controls, the Lines and PictureBoxes you mentioned in your question.
Why is a PictureBox preferable? Because you can profit from the ScaleMode property, set it to 3-Pixeland use pixel-exact scrolling. With Frames you can't do that, you are limited to just Twips.
By using a contained control you have two advantages:
you can visually place and reposition the controls ypu need inside the IDE
you need to scroll just only one control - all other hosted controls will
move together
The boring thing you must code is the synchronization of the container with the ScrollBars.
But luckily, as VB6 has been going a long way, you will find enough cut-and-paste code examples of such a task, one of which is on VBForums: Scroll bar in picturebox
Some final notes:
PictureBoxes in VB6 are constrained to a maximum size of 16,383 x 16,383 pixels. If your scrollable area should be bigger, you may implement a kind of custom "infinite scroller", and manage the position of your controls by grouping them, and you will need some additional coding.
ScrollBars in VB6 can range from a minimum value of -32,768 to a maximum value of 32,767. If you need more, you will end up with some other additional coding tasks.
If you stick to Twips, you can have a bigger logical area available - for example: until 245,745 with the typical 15 TwipsPerPixel - but you can't use such a big value with ScrollBars.
Here is a simple example illustrating what you requested. The key is that the scrollable area must be a container control hosting the controls you wish to scroll.
Option Explicit
Private oldPos As Integer
Private Sub Form_Load()
HScroll1.Min = 0
HScroll1.Max = 1000
HScroll1.SmallChange = Screen.TwipsPerPixelX * 10
HScroll1.LargeChange = HScroll1.SmallChange
End Sub
Private Sub HScroll1_Change()
ScrollPictureBox
End Sub
Private Sub HScroll1_Scroll()
ScrollPictureBox
End Sub
Private Sub ScrollPictureBox()
Dim c As Control
For Each c In Me.Controls
If c.Container.Name = "Picture1" And Not TypeOf c Is HScrollBar Then
c.Left = c.Left - (oldPos - HScroll1.Value)
End If
Next
oldPos = HScroll1.Value
End Sub
In this code, Picture1 is a PictureBox (the scrollable area) containing HScroll1 (a horizontal scrollbar) and the other controls you wish to scroll.
I have lot of pictures embedded in the Microsoft Powerpoint 2013 presentation. In Powerpoint 2013, I can right click on a picture object and then use "Save As Picture" to save the image to local disk. But this is manual way. I want to know if there is any way of automating the same through VBA? I am able to loop through the Shapes collection and then determine the type of the object. But I am not able to figure out which properties or methods are relevant for storing the picture to the local disk? Following is code snippet of iterating through the Shapes collection and determining if the Shape is of type msoPicture
For currentSlideIndex = 1 To totalSlidesCount
Set currentSlide = ActivePresentation.Slides(currentSlideIndex)
For Each mediaShape In currentSlide.Shapes
mediaCounter = mediaCounter + 1 'for each shape in the slide
If currentSlideIndex = 3 Then
If mediaShape.Type = msoPicture Then
MsgBox ("Shape Type Picture is " + CStr(mediaShape.Type) )
End If
End If
Next mediaShape
mediaCounter = 0 'Reset to 0 for the new slide
Next
You can export the current shape to a picture using the shape's .Export method.
This is normally hidden, so you won't get intellisense help on it by default, so:
Go into the IDE
Press F2 to open the object browser
Rightclick in the pane to the right of Classes, where you see "Members of ..." at the top.
Put a check next to Show Hidden Members
Now you'll get intellisense guidance when you type .Export on a slide shape.
Note also that if a shape is Type 14 (placeholder), it can contain a picture, so you may want to add something like:
If mediaShape.Type = msoPlaceholder Then
If mediaShape.PlaceholderFormat.ContainedType = msoPicture Then
' it's also a picture
End If
End if
And to add further entertainment value you might also have .Type = msoLinkedPicture, and even in some cases msoEmbeddedOLEObject that happens to be a picture.
(This seems mostly to be a PowerPoint 2007 specific problem, which I can't easily reproduce in PPT 2010)
Easy way to reproduce locally is to:
1) Insert a shape into blank slide
2) Run command: ActivePresentation.Slides(1).Shapes(1).Delete in immediate window in Visual Studio. (You can alternatively delete through C#)
3) Undo the deletion in the PowerPoint presentation (do this non-programatically)
For some reason, you cannot access the shape again using calls like:
ActivePresentation.Slides(1).Shapes(1) //Does not allow any methods/properties to work
The only thing I've remotely gotten is that through Selection.ShapeRange, you can kind of get a reference to the item, but most of the Properties/Methods throw ComExceptions when trying to using that object.
Does anyone know how I can re-get the shape or somehow refresh the presentation to get some clean Com Objects?
I can confirm in Ppt2007 SP3. Try as workaround .cut and .paste. Afterwards I was able to access the other methods/properties. - cheers, www.MSO-dlx.com
ActivePresentation.Slides(1).Shapes(1).Delete
Application.CommandBars.ExecuteMso "Undo" 'or manually Undo
ActiveWindow.Selection.SlideRange(1).Shapes(1).Cut
ActiveWindow.Selection.SlideRange(1).Shapes.Paste
ActiveWindow.Selection.SlideRange(1).Shapes(1).TextFrame.TextRange.Text = "ABC"
so, I can confirm that this is an issue; even in 2010 and found a "cheaper" alternative:
Public Sub arf()
Dim arf As Slide
Dim shape As shape
Dim shapes As shapes
Set shapes = ActivePresentation.Slides(1).shapes
Set shape = shapes(2)
shape.Select
shape.Delete
Application.CommandBars.ExecuteMso "Undo"
MsgBox ("shape: " & shape.Name & ",Type: " & shape.Type)
Set shapes = ActivePresentation.Slides(1).shapes
Set shape = Nothing
Set shape = shapes(2)
' Cut and paste makes this work, but not required...
'shape.Select
'shape.Cut
'shapes.Paste
'Set shape = Nothing
'Set shape = shapes(2)
Set arf = shape.Parent
MsgBox ("slide: " & arf.Name)
End Sub
Just now I have successfully solved the problem, share the web page which helped a lot : https://www.add-in-express.com/creating-addins-blog/2014/06/24/exception-hresult-0x800a01a8/
The critical point is releasing the object after deleting it,which is exactly as Skovly and sharkTwo did.However,I don't know how to do this using C#,and the link gave me the answer.
Marshal.ReleaseComObject(titleShape); titleShape = null;
Just like this.