PowerPoint using macro to delete text boxes after printing

Hi,
We created custom shows in Powerpoint and are running a macro to insert temporary page numbers on the slides before printing.  The issue is that I need to remove the page numbers after printing.  I'm a novice at VBA so I'm sure there is an easy
solution, but nothing I've tried so far has been successful.  The code is displayed below for your reference.  Any help is greatly appreciated. Thanks!
Sub PrintCustomShow()
      ' Change this number to specify your starting slide number.
      Const lStartNum As Long = 1
      ' Ask the user which custom show they want to print.
      Dim strShowToPrint As String, strPrompt As String
      Dim strTitle As String, strDefault As String
      ' See if any custom shows are defined.
      If ActivePresentation.SlideShowSettings.NamedSlideShows.Count _
         < 1 Then
         ' No custom shows are defined.
         ' Set up the string for the message box.
         strPrompt = "You have no custom shows defined!"
         ' Display the message box and stop the macro.
         MsgBox strPrompt, vbCritical
         End
      End If
      ' Find the page number placeholder; if found, pick up the style.
      Dim rect As PageBoxSize
      Dim oPlaceHolder As Shape
      Dim bFound As Boolean: bFound = False
      For Each oPlaceHolder In _
         ActivePresentation.SlideMaster.Shapes.Placeholders
         ' Look for the slide number placeholder.
         If oPlaceHolder.PlaceholderFormat.Type = _
            ppPlaceholderSlideNumber Then
            ' Get the position of the page number placeholder.
            rect.l = oPlaceHolder.Left
            rect.t = oPlaceHolder.Top
            rect.w = oPlaceHolder.Width
            rect.h = oPlaceHolder.Height
            ' Get the formatting of the slide number placeholder.
            oPlaceHolder.PickUp
            ' Found the slide number placeholder, so set the
            ' bFound boolean to True.
            bFound = True
            Exit For
         End If
      Next oPlaceHolder
      ' See if a slide number placeholder was found.
      ' If not found, exit the macro.
      If bFound = False Then
         ' Unable to find slide number placeholder.
         MsgBox "Your master slide does not contain a slide number " _
            & "placeholder. Add a " & vbCrLf & "slide number placeholder" _
            & " and run the macro again.", vbCritical
         End
      End If
      ' Set up the string for the input box.
      strPrompt = "Type the name of the custom show you want to print." _
         & vbCrLf & vbCrLf & "Custom Show List" & vbCrLf _
         & "==============" & vbCrLf
      ' This is the title of the input box.
      strTitle = "Print Custom Show"
      ' Use the first defined show as the default.
      strDefault = _
         ActivePresentation.SlideShowSettings.NamedSlideShows(1).Name
      ' Obtain the names of all custom slide shows.
      Dim oCustomShow As NamedSlideShow
      For Each oCustomShow In _
         ActivePresentation.SlideShowSettings.NamedSlideShows
         strPrompt = strPrompt & oCustomShow.Name & vbCrLf
      Next oCustomShow
      Dim bMatch As Boolean: bMatch = False
      ' Loop until a named show is matched or user clicks Cancel.
      While (bMatch = False)
         ' Display the input box that prompts the user to type in
         ' the slide show they want to print.
         strShowToPrint = InputBox(strPrompt, strTitle, strDefault)
         ' See if user clicked Cancel.
         If strShowToPrint = "" Then
            End
         End If
         ' Make sure the return value of the input box is a valid name.
         For Each oCustomShow In _
            ActivePresentation.SlideShowSettings.NamedSlideShows
            ' See if the show is in the NamedSlideShows collection.
            If strShowToPrint = oCustomShow.Name Then
               bMatch = True
               ' Leave the For loop, because a match was found.
               Exit For
            End If
            ' No match was found.
            bMatch = False
         Next oCustomShow
      Wend
      ' Get the array of slide IDs used in the show.
      Dim vShowSlideIDs As Variant
      With ActivePresentation.SlideShowSettings
          vShowSlideIDs = .NamedSlideShows(strShowToPrint).SlideIDs
      End With
      ' Loop through the slides and turn off page numbering.
      Dim vSlideID As Variant
      Dim oSlide As Slide
      Dim Info() As SlideInfo
      ' Make room in the array.
      ReDim Preserve Info(UBound(vShowSlideIDs) - 1)
      ' Save the current background printing setting and
      ' then turn background printing off.
      Dim bBackgroundPrinting As Boolean
      bBackgroundPrinting = _
         ActivePresentation.PrintOptions.PrintInBackground
      ActivePresentation.PrintOptions.PrintInBackground = msoFalse
      ' Loop through every slide in the custom show.
      Dim x As Long: x = 0
      For Each vSlideID In vShowSlideIDs
         ' The first element in the array is zero and not used.
         If vSlideID <> 0 Then
            ' Add slide ID to the array.
            Info(x).ID = CLng(vSlideID)
            ' Get a reference to the slide.
            Set oSlide = ActivePresentation.Slides.FindBySlideID(vSlideID)
            ' Store the visible state of the page number.
            Info(x).IsVisible = oSlide.HeadersFooters.SlideNumber.Visible
            ' Turn off page numbering, if needed.
            If Info(x).IsVisible = True Then
               oSlide.HeadersFooters.SlideNumber.Visible = msoFalse
            End If
            ' Create a text box and add a temporary page number in it.
            Dim oShape As Shape
            Set oShape = _
               oSlide.Shapes.AddTextbox(msoTextOrientationHorizontal, _
                                        rect.l, rect.t, _
                                        rect.w, rect.h)
            ' Apply the formatting used for the slide number placeholder to
            ' the text box you just created.
            oShape.Apply
            ' Add the page number text to the text box.
            oShape.TextFrame.TextRange = CStr(x + lStartNum)
            ' Increment the array element positon.
            x = x + 1
         End If
      Next vSlideID
' Print the custom show. NOTE: You must turn background printing off.
             With ActivePresentation
             With .PrintOptions
             .RangeType = ppPrintNamedSlideShow
             .SlideShowName = strShowToPrint
             End With
             .PrintOut
            End With
      ' Restore the slide information.
      For x = 0 To UBound(Info)
         ' Get a reference to the slide.
         Set oSlide = ActivePresentation.Slides.FindBySlideID(Info(x).ID)
         oSlide.HeadersFooters.SlideNumber.Visible = Info(x).IsVisible
      Next x
      ' Restore the background printing setting.
      ActivePresentation.PrintOptions.PrintInBackground = _
         bBackgroundPrinting
   End Sub

Hi hlolrich,
According to the description, you want to remove the shapes which created after you print the presentaion.
I suggest that you name the shape you added with some rule, then we can delete thease shapes via the name rule.
And here is a sample that you delete the shapes which name contains the
myShape words on the first slide for your reference:
Sub deleteShapes()
For Each aShape In Application.ActivePresentation.Slides(1).Shapes
If InStr(aShape.Name, "myShape") Then
aShape.Delete
End If
Next aShape
End Sub
Also you can learn more about PowerPoint developing from link below:
How do I... (PowerPoint 2013 developer reference)
PowerPoint 2013
Regards & Fei
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey.

Similar Messages

  • URGENT-Does Erase all Data and restoring from a previously made backup permanently delete text messages after that backup??

    Does restoring from a previously made backup permanently delete text messages after that backup?
    I made a Icloud back up two days ago. I have text messaged and sent emails since. I haven't backed up again yet and I was wondering that if I erase my phone and back up to that Icloud Back up made two days ago, the texts and emails I have sent SINCE then will be permanently deleted? AKA they can never be found again by anyone?

    That is correct you can only get back data that was backed up.

  • Adobe Acrobat Pro text box not printing and is hidden under box highlight.

    Adobe Acrobat Pro 10.1.13.  I am completing a form with text box throughout the document. I can no get the text box to printing and the text is hidden under box highlight.  I have tried printing with the print feature 'Comments & Forms/ Document and Markups' with no luck.

    It's doing that because you have field highlighting enabled. YOu can either turn it off or make the field read-only (if it's only used for display and not entry).

  • IPhoto books- Delete text boxes?

    For several pages in an iPhoto book I am making, I do not want any text or descriptions. However, there are empty text boxes whose outlines are still showing up. I don't want the pages to print with the text box outlines. There is nothing typed in the boxes and I have tried deleting them, but I can't figure out how to.
    For the portfolio theme, the layout options include the text boxes. All the pictures are situated how I want them, but I just don't want the text box rectangles showing up. Any suggestions?
    Message was edited by: wsull

    Most page layouts offer one with and without text boxes. Check the layout menu at the bottom to see if there's not one without text for your theme.
    TIP: For insurance against the iPhoto database corruption that many users have experienced I recommend making a backup copy of the Library6.iPhoto (iPhoto.Library for iPhoto 5 and earlier versions) database file and keep it current. If problems crop up where iPhoto suddenly can't see any photos or thinks there are no photos in the library, replacing the working Library6.iPhoto file with the backup will often get the library back. By keeping it current I mean backup after each import and/or any serious editing or work on books, slideshows, calendars, cards, etc. That insures that if a problem pops up and you do need to replace the database file, you'll retain all those efforts. It doesn't take long to make the backup and it's good insurance.
    I've created an Automator workflow application (requires Tiger or later), iPhoto dB File Backup, that will copy the selected Library6.iPhoto file from your iPhoto Library folder to the Pictures folder, replacing any previous version of it. There are versions that are compatible with iPhoto 5, 6, 7 and 8 libraries and Tiger and Leopard. Just put the application in the Dock and click on it whenever you want to backup the dB file. iPhoto does not have to be closed to run the application, just idle. You can download it at Toad's Cellar. Be sure to read the Read Me pdf file.
    NOTE: iPhoto 8's new option in it's rebuild library window, "Rebuild the iPhoto Library Database from automatic backup" may make this tip obsolete. We'll know when users have occasion to use it and see if that's the case.

  • Deleting Text Box, but not text, in Pages '09

    I use Readiris to scan documents, which then open in Word. All text is placed in text boxes (sometimes line by line). When I import the Word docs into Pages, I have literally hundreds of text boxes, when really all I want is to work with the text. Is there a way to delete the text boxes without deleting the text in them?

    --
    --[SCRIPT extractRawTextFromPages]
    Open a Pages document
    run the script.
    You will get on the Desktop a text file entitled
    "extractedRawText.txt"
    containing the document's raw text.
    Yvan KOENIG (Vallauris, FRANCE)
    2009/07/03 for AW Draw documents
    2009/08/07 Adapted for Pages
    on run
    tell application "Pages"
    activate
    tell document 1
    set rawText to ""
    try
    set rawText to "Main Layer" & return & body text & return
    end try
    set textBoxes to get text boxes
    if textBoxes is not {} then
    repeat with i from 1 to count of textBoxes
    set rawText to rawText & "text block #" & i & return & (get object text of item i of textBoxes) & return & return
    end repeat
    end if
    end tell -- document
    end tell -- Appleworks
    if rawText is not "" then
    set nomDuRapport to "extractedRawText.txt"
    set p2d to path to desktop
    set p2r to (p2d as text) & nomDuRapport
    tell application "System Events"
    if exists (file p2r) then delete (file p2r)
    make new file at end of p2d with properties {name:nomDuRapport}
    end tell -- System Events
    write (rawText as text) to (p2r as alias)
    end if
    end run
    --[/SCRIPT]
    Yvan KOENIG (Vallauris, FRANCE vendredi 7 août 2009 21:45:45)

  • Script that will automaticly set the focus to the next text box after the previous one is completed

    Specificly, entering a SSN into a form with three text boxes. 1st box for first 3 digits, 2nd box for middle 2 digits, and 3rd box for last 4 digits. I would like the user to be able to enter the 1st three digits into the 1st box, and after the 3rd digit is entered, the focus jumps to the 2nd box, then once the middle two are entered, the focus jumps the the 3rd box without having to manually use the tab key to advance through the boxes. Thanks.

    See JavaScript - setFocus Method for tabbing to next form field for a sample form that uses a document level script and custom keystroke script. See Entering Document Scripts and Entering scripts for form fields by Thom Parker for detailed instructions on entering or viewing these type of scripts.

  • How to use dynamic id of text box document.getElementById in JQuery

    Dear Sir,
    I am having code in ajax
    I am bringing id from ajax
    code is for text box id='textbox1"+i+"'
    here id name I am giving textbox and i is my increamented value and appending with textbox
    the id is dynamically generating it is like textbox0 on next textbox2
    But
    how I ll use the same dynamically generated id in on of my jquery function using document.getElementbyid
    I am not good in jquery.
    please help
    regards sanat

    That is a JQuery question, i.e. a JavaScript question, and this is a Java forum. Locking.

  • Pages - delete text box

    Am I being really dim? I want to delete a text box from my document, I can't figure it out. It just says 'text' inside it. It doesn't show when I print the page, but it's bugging me. Thanks.

    What do you get when you touch/select the text? I am getting a pop-up that reads: "select/select all/paste/copy style". When I "select all" the text is then highlighted in light blue with the pop-op options now reading: "cut/copy/paste/copy style". If I choose/touch "select all" the text disappears.
    Message was edited by: Jazmaraz

  • How to change the Label of input text box after selecting a value in LOV.

    Hi All,
    I have a requirement that after selecting a value in LOV the Label of the next input text box should change accordingly.
    I am able to do cascading LOV's.
    how can i meet this requirement?
    TIA,
    Vishal

    Sample:
    JSPX Page:
    <?xml version='1.0' encoding='UTF-8'?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.1"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
    <jsp:directive.page contentType="text/html;charset=UTF-8"/>
    <f:view>
    <af:document id="d1">
    <af:messages id="m1"/>
    <af:form id="f1">
    <af:panelFormLayout id="pfl1">
    <af:inputText value="#{bindings.FirstName.inputValue}"
    label="#{bindings.FirstName.hints.label}"
    required="#{bindings.FirstName.hints.mandatory}"
    columns="#{bindings.FirstName.hints.displayWidth}"
    maximumLength="#{bindings.FirstName.hints.precision}"
    shortDesc="#{bindings.FirstName.hints.tooltip}"
    id="it1" *binding="#{ForumSampleBean.inputText}"*
    *partialTriggers="departmentIdId">*
    <f:validator binding="#{bindings.FirstName.validator}"/>
    </af:inputText>
    <af:inputComboboxListOfValues id="departmentIdId"
    popupTitle="Search and Select: #{bindings.DepartmentId.hints.label}"
    value="#{bindings.DepartmentId.inputValue}"
    label="#{bindings.DepartmentId.hints.label}"
    model="#{bindings.DepartmentId.listOfValuesModel}"
    required="#{bindings.DepartmentId.hints.mandatory}"
    columns="#{bindings.DepartmentId.hints.displayWidth}"
    shortDesc="#{bindings.DepartmentId.hints.tooltip}"
    *autoSubmit="true"*
    *immediate="true"*
    *valueChangeListener="#{ForumSampleBean.lovValueChangeListener}">*
    <f:validator binding="#{bindings.DepartmentId.validator}"/>
    <af:convertNumber groupingUsed="false"
    pattern="#{bindings.DepartmentId.format}"/>
    </af:inputComboboxListOfValues>
    </af:panelFormLayout>
    </af:form>
    </af:document>
    </f:view>
    </jsp:root>
    *Managed Bean:*
    public class ForumSampleBean {
    private RichInputText inputText;
    public ForumSampleBean() {
    super();
    public void setInputText(RichInputText inputText) {
    this.inputText = inputText;
    public RichInputText getInputText() {
    return inputText;
    public void lovValueChangeListener(ValueChangeEvent valueChangeEvent) {
    *this.inputText.setLabel("New Label");*
    Thanks,
    Navaneeth

  • Why is text washed-out when I'm using a color-filled text box?

    I have created some text boxes in InDesign. I've colored them a lighht green, and I am trying to type into them but my text is washed out, even though I am picking a much darker text than the box fill. How do I fix this? I am working on a tight deadline! Please help.

    Thanks. Here's a screenshot. I'm referring to the light green boxes on the side. The text I'm using is the same color as the text above that says "appalachian ohio" but it isn't showing up.

  • Delete text box?

    I inadvertently created a text-box.  How do I get rid of it?

    I know that you are very fluent in Pages and you know worlds more than I do. I have read more than a few of your posts. But it seems to work for me. If I place a text box in a document and then click inside the text box - it deletes the entire text box.
    I guess that I am doing something wrong when I create the text box that allows me to remove it. I can click inside the text block and remove it. I have done it ten times now. I have pasted into the text box, I have typed my own text into the text box, saved the document, duplicated it.... every time I click inside the text box, I can delete it.
    I am creating the text box from here.

  • Blank space between text boxes after publishing

    I have a few pages with a relatively large number of text boxes on them (perhaps 20). These are all separated by a few pixels in iWeb, but when I publish to .mac, I see quite a bit of space between them. Is this a known problem? Is there a fix?
    Thanks,
    Patrick

    Go into iWeb and check that your text boxes are not overlapping each other. If they are, this can cause problems when publishing. Check that they do not overlap and re-publish and see what happens then.

  • Using html in a text box?

    I've created a regular text box in Flash and have found that I can only apply italic, bold, centered etc options to the whole text box. What do I need to do to be able to apply workinf HTML tags to my text to correct this?

    What buttons do I press in order to do that?
    And if that won't give me alignment choices aswell, then what will?

  • HT204364 Deleting text in iPhoto print books

    In creating photo books with iPhoto '11, some of the layouts have text boxes... if I delete the text to create a white space area, will it have a border from text box? I basically just want the white space (squares) to break up the page, thanks

    No but you will get a warning of missing text. Enter a single space
    And always preview before ordering. http://support.apple.com/kb/PH2486
    LN

  • HOW TO DELETE DUNNING RUN AFTER PRINT OUT?

    Dear all,
    does anybody know if it's possible to cancel a dunning run after the notices have been printed (except manually by changing all documents and all master data)
    WITH ADVANCE THANKS
    KRISHNA KUMAR

    Hi Krishna,
    Why do you want to re-run the Dunning run after printing them out?
    Anyway there is a program SAPF150D2 that enables you to re-edit the Dunning run. However whilst a Dunning letter is not a legal letter it is binding and so to add some control to SAP I am sure there is not a way where you can cancel the run and start again. What is to say that you send the wrong letters out.
    You can create a simple program to go to FB09 to delete the Dunning level and the date of the last Dunning run.

Maybe you are looking for

  • Gantt chart: Don't know how to use the tooltipkeys and toolkeylabel

    I have a problem. Don't know how to use the tooltipkeys and toolkeylabel. I used jquery to select the gantt bars and on mouse over i was getting the task id "tid" then passing it to adf bean with serverlistener and showing a popup that is adf compone

  • SAP -ISU-DEVICE MANAGEMENT-MM LINK MATERIAL

    Hi, Basically i am a MM Consultant,recently i have been assinged to IS-Utilities Project,i wanted to know the what are the things i have to know/study for the understanding of the ISU and MM and where i will get the material for IS-Utilities speciall

  • Contracts in Classic Scenario

    In Classic Scenario SRM 5.0 with ECC 6.0, how can I create an ECC Contract with a requirement from the Purchaser's Worklist ? Do I use the Global Outline Agreement? If so, what are the config steps ? Full points assured. Thx. Raja

  • Too Many Snapshots - Only Need One

    We have a web db server that we reset every night to a single snapshot, and it never changes. Vmware server creates a snapshot vmdk file every day though, and it fills up the disk. The host is windows 2003 x64 and the guest is the same. Can we delete

  • Is it possible to parse a cursor record into a function if so how?

    My question is basically as the title says. I would like to know if i can parse a cursor record through a function for example FOR r1 in c1 LOOP calcuate(r1.mark1, r1.mark2,r1.mark3, r1.student) END LOOP where fucntion looks similar to CREATE functio