2013-05-31 9 views
9

コンテキスト: C#のPowerPointスライドにはSlide.Nameというプロパティ(通常は任意の文字列値が含まれています)があります。 私のC#アプリケーションでは、このプロパティを使用してスライドを識別したいと考えています(スライドの順序は信頼できません)。Powerpoint:手動でスライド名を設定する

質問: PowerPointアプリケーションでSlide.Nameプロパティを手動で設定する方法を教えてください。

私の問題は「How to name an object within a PowerPoint slide?」と非常によく似ていますが、スライドレベルのみです。

ご協力いただければ幸いです。

答えて

4

手動でスライド名を設定することはできませんが、コードは少しシンプルです。たとえば、VBAでは、

Sub NameThatSlide() 
    ActivePresentation.Slides(1).Name = "Whatever You Like Here" 
End Sub 
+0

これは、スライドプレゼンテーション編集ウィンドウでスライドの名前を効果的に変更します。ただし、VBAエディタでは、スライド*は、元の*名前(「スライド1」や「スライド32」など)で表示されます。スライドが削除されるギャップがあります。 VBAProjectの "Microsoft PowerPointオブジェクト"リストに表示される名前を、PowerPoint 2013のスライドの.Nameプロパティと一致するように変更する方法はありますか? – DRC

+0

私はそこにいるとは思わない。 PowerPointの名前は作成時にスライドします。各スライドには.Nameプロパティもあります。これはPPTが最初にスライドの名前と同じ文字列に設定します。この.Nameプロパティは、スライドの内部名ではなく、.Nameを設定すると変更されます。プレゼンテーションXMLを編集して内部名を変更することは可能かもしれません。私は興味があります:名前を変更する必要は何ですか? –

+0

返信いただきありがとうございます、@ Steve Rindsberg 「必要性」は、VBAのプログラミングを容易にするためのものです。私は学生のためのトレーニングツールになる "プレゼンテーション"を持っています。それはVBAによって完全に制御されるので、VBAコードは、学生が次のスライドなどを続けることを許可されたときに制御します。スライドの順序を変更し、多数の「テスト」スライドを実行したので、スライドが分かりやすい名前を持っている編集ビューのスライドと混同していますが、スライドには編集ビューの名前と一致しない番号があるVBAProjectビューに切り替わります。 – DRC

10

スライドに名前を編集できる機能はありません。 Steveが言及したように、VBAコードを使用してそれを行う必要があります。スライド名前は、スライドをさらに挿入することによって決して変更されず、PowerPointを閉じても同じままになります。 VBAコードで設定されているスライド名は永続的です。ここで私はあなたが簡単に現在選択されているスライドの名前を表示し、名前を変更できるようにすることができるように書いたいくつかのコードです:

'------------------------------------------------------------------ 
' NameSlide() 
' 
' Renames the current slide so you can refer to this slide in 
' VBA by name. This is not used as part of the application; 
' it is for maintenance and for use only by developers of 
' the PowerPoint presentation. 
' 
' 1. In Normal view, click on the slide you wish to rename 
' 2. ALT+F11 to VB Editor 
' 3. F5 to run this subroutine 
'------------------------------------------------------------------ 
Sub NameSlide() 
    Dim curName As String 
    curName = Application.ActiveWindow.View.Slide.name 

    Dim newName As String 
retry: 
    newName = InputBox("Enter the new name for slide '" + curName + "', or press Cancel to keep existing name.", "Rename slide") 
    If Trim(newName) = "" Then Exit Sub 

    Dim s As Slide 

    ' check if this slide name already exists 
    On Error GoTo SlideNotFound 
    Set s = ActivePresentation.Slides(newName) 
    On Error GoTo 0 

    MsgBox "Slide with this name already exists!" 
    GoTo retry 

    Exit Sub 

SlideNotFound: 
    On Error GoTo 0 
    Application.ActiveWindow.View.Slide.name = newName 
    MsgBox "Slide renamed to '" + newName + "'." 

End Sub 
+0

このスクリプトは、VBAプログラミングで非常に便利です。スライド名をVBAコードで確実に使用できるように、すべてのスライドの名前を変更できます。 –

1

私はこれがためSlide.Nameプロパティを設定することができますことは確かではありませんよ私はVBAプログラマーではありませんが、とにかくPowerPoint 2010でスライドに名前を付ける最も簡単な方法はアウトラインビューを使用しています。

作成したスライドの一番左にマウスを置くと、一種の垂直スライドソーターが右にドラッグできます。このペインの上部には、スライドのの2つのタブが表示されます。概要

選択アウトラインには、番号が付けられた各スライドと、スライドの並べ替えを可能にするグレーのグラブボタンが表示されます。その右にあるをクリックすると、好きな名前を入力することができます。ホーム

メインビューウィンドウでは、スライドにホームが埋め込まれています。その後、フォントの色を背景に変更したり、プレゼンテーションフレームの外にテキストを移動したりして隠すか、隠すことができます。

BTWこれらの名前はハイパーリンクで使用できます。

+0

これを行うには何らかの理由がありますが、残念ながらスライドの '.Name'プロパティは実際には変更されません。 –

1

は、Sub SplitFile()関数を使用して、> 100個のスライドのデッキから個々のスライドを作成しました。すべてがうまくいった!しかし、どのスライドにもタイトルが付いていると仮定して、ファイルの名前を自動的に変更するためにどのようなコードを使用するのか誰にでも教えていただけますか?私はスライドのタイトルを作成された新しい、個々のスライドのファイル名にしたい。

ここには、オンラインで投稿した人のおかげで、個別のスライドを(個別のファイルとして)作成するために使用したコードがあります。

サブSplitFile() 暗いlSlidesPerFile限り 暗いlTotalSlides限り 暗いoSourcePresとしてプレゼンテーション 暗いsFolderとしてプレゼンテーション 薄暗いotargetPres文字列として 暗いSEXT文字列として 暗いsBaseNameストリング 暗いlCounter限り 暗いとして私たちは薄暗いがString

限り 薄暗いsSplitPresName限り 薄暗いlWindowEnd限り 薄暗いlWindowStartとして のxは に分割されますどのように多くのロング」としてlPresentationsCount
On Error GoTo ErrorHandler 

Set oSourcePres = ActivePresentation 
If Not oSourcePres.Saved Then 
    MsgBox "Please save your presentation then try again" 
    Exit Sub 
End If 

lSlidesPerFile = CLng(InputBox("How many slides per file?", "Split Presentation")) 
lTotalSlides = oSourcePres.Slides.Count 
sFolder = ActivePresentation.Path & "\" 
sExt = Mid$(ActivePresentation.Name, InStr(ActivePresentation.Name, ".") + 1) 
sBaseName = Mid$(ActivePresentation.Name, 1, InStr(ActivePresentation.Name, ".") - 1) 

If (lTotalSlides/lSlidesPerFile) - (lTotalSlides \ lSlidesPerFile) > 0 Then 
    lPresentationsCount = lTotalSlides \ lSlidesPerFile + 1 
Else 
    lPresentationsCount = lTotalSlides \ lSlidesPerFile 
End If 

If Not lTotalSlides > lSlidesPerFile Then 
    MsgBox "There are fewer than " & CStr(lSlidesPerFile) & " slides in this presentation." 
    Exit Sub 
End If 

For lCounter = 1 To lPresentationsCount 

    ' which slides will we leave in the presentation? 
    lWindowEnd = lSlidesPerFile * lCounter 
    If lWindowEnd > oSourcePres.Slides.Count Then 
     ' odd number of leftover slides in last presentation 
     lWindowEnd = oSourcePres.Slides.Count 
     lWindowStart = ((oSourcePres.Slides.Count \ lSlidesPerFile) * lSlidesPerFile) + 1 
    Else 
     lWindowStart = lWindowEnd - lSlidesPerFile + 1 
    End If 

    ' Make a copy of the presentation and open it 

    For Each oSlide In ActiveWindow.Presentation.Slides 
strTitles = strTitles _ 
    & "Slide: " _ 
    & CStr(oSlide.SlideIndex) & vbCrLf _ 
    & oSlide.Shapes.Title.TextFrame.TextRange.Text _ 
    & vbCrLf & vbCrLf 

次にoSlide 誤差に後藤のErrorHandler

intFileNum = FreeFile

sSplitPresName = sFolder & sBaseName & _ "_" & CStr関数(lWindowStart)& " - " & CStr関数(lWindowEnd)& " " & SEXT oSourcePres.SaveCopyAs sSplitPresName、ppSaveAsDefault 設定otargetPres = Presentations.Open(sSplitPresName、、、TRUE)

With otargetPres 
     For x = .Slides.Count To lWindowEnd + 1 Step -1 
      .Slides(x).Delete 
     Next 
     For x = lWindowStart - 1 To 1 Step -1 
      .Slides(x).Delete 
     Next 
     .Save 
     .Close 
    End With 

Next ' lpresentationscount 

NormalExit: 出口サブ のErrorHandler: のMsgBox "エラーが発生しました" 再開NormalExit End Subの

0

スライドの名前を手動またはVBAで変更できます。どのように知っていれば、ドアはいくつか興味深い可能性が開かれます。これについては、以下のコードで説明します。

スライドの名前を手動で変更します。この機能はVBAエディタのプロパティペインには表示されませんが、ではなく、にコーディングが必要です。

  1. デベロッパーリボンが表示されていない場合、それを有効にします。ファイル>オプション>リボンのユーザー>開発メインタブを確認してください。 開発リボンから

  2. 、Visual Basicエディターを開くには、Visual Basicのメニュー項目をクリックしてください。

  3. Ctrl + Rキーを押して、プロジェクトエクスプローラペインに移動します。

  4. 展開し、それを選択するための任意のスライドに

  5. クリックして "のMicrosoft PowerPointはオブジェクト"。

  6. F4キーを押して、プロパティペインに移動します。

  7. 編集(名前)項目、およびプレス名前の変更を適用するにはを入力します。

スライド名の変更は、VBAプロジェクトエクスプローラペインにすぐに表示されないことがあります。プロパティペインで名前が正しい限り、名前は正常に変更されました。また、トリックを行います

このVBAコード(非表示スライド番号1):

ActivePresentation.Slides(1).SlideShowTransition.Hidden = msoTrue 

このコードブロックは、スライド名を管理するためのいくつかの方法をカバーし、主要な質問に答えます。

Option Explicit 

Public Function RenameSlide(oldName As String, newName As String) 
' RenameSlide finds slide oldName and renames it to newName. 
' Arguements: 
' oldName: current (old) name of existing slide 
' newName: new name for slide. 
' 
    Dim tempBool As Boolean 
    Dim sld As Slide 
    Dim RetVal(0 To 1) As String 

    ' Check if oldName can be found. 
    If SlideExists(oldName) Then 
     Set sld = Application.ActivePresentation.Slides(oldName) 
    Else 
     RetVal(0) = 1 'Error 1 
     RetVal(1) = "Error 1: slide with name " & oldName & " not found. Aborting." 
     Exit Function 
    End If 

    ' Check if this slide name newName already exists. 
    If SlideExists(newName) Then 
     RetVal(0) = 2 'Error 1 
     RetVal(1) = "Error 2: slide with name " & newName & " already exists. Aborting." 
     Exit Function 
    End If 

    ' Rename the slide 
    'Application.ActivePresentation.Slides(oldName) = newName 
    Application.ActivePresentation.Slides(oldName).Select 
    Application.ActiveWindow.View.Slide.Name = newName 'current slide 
    RetVal(0) = 0 'Success 
    RetVal(1) = "Success: slide renamed from '" & oldName & "' to '" & newName & "'." 

End Function 

Public Sub SetSlideName() 
' Prompt user for new name for active slide. 
' 
    Dim oldName As String 
    Dim newName As String 
    Dim sld As Slide 
    Dim msg As String 

    ' Get current name of active slide. 
    oldName = Application.ActiveWindow.View.Slide.Name 

    msg = "Enter the new name for slide '" + oldName + "'." 
retry: 
    newName = "" 
    ' Prompt for new slide name. Loop until a name of at least 1 character is provided. 
    Do While newName = "" 
     newName = InputBox(msg, "Rename slide") 
     newName = Trim(newName) 
     If Len(newName) = 0 Then 
      msg = "Try again. You must enter a slide name to continue." 
     ElseIf newName = oldName Or newName = Str(vbCancel) Then 
      Exit Sub 
     End If 
    Loop 

    ' If an existing slide already has name newName, then 
    ' go back and prompt user again.slide name already exists 
    If SlideExists(newName) Then 
     msg = "Slide with this name already exists!" 
     GoTo retry 
    End If 

    ' Set the new slide name 
    Application.ActiveWindow.View.Slide.Name = newName 
    MsgBox "Slide renamed to '" + newName + "'." 
End Sub 

Public Function SlideExists(SlideName As String) As Boolean 
    Dim RetVal As Boolean 
    Dim sld 

    ' Assume slide does not exist. 
    SlideExists = False 

    ' Try to find slide by name. 
    ' If we error out, the slide does NOT exist. 
    On Error GoTo NoSlide 
    Set sld = ActivePresentation.Slides(SlideName) 

    ' If we got this far, the slide DOES exist. 
    SlideExists = True 
    Exit Function 

NoSlide: 
    ' Error setting slide objects shows 
    ' that slides does NOT exist. 
    SlideExists = False 
End Function 

私は、スライドの名前付けトリックと小さなVBAを使用して、特定のスライドを選択的に印刷から削除します。私は、マクロリストを作成するためにいくつかの余分なVBAマクロを追加しました。任意のスライドから:開発者リボン>マクロ>マクロの選択>実行ボタンをクリックします。このメソッドを使用して、PresentSlide、DontPresentSlide、PrintSlide、DontPrintSlideマクロをキックオフします。いろいろなスライドを適切にタグ付けしたら、プレゼンテーションまたはプリント前にPrepToPresentSlidesまたはPrepToPrintSlidesマクロを実行するだけです。

これらのマクロで少し遊んでコメントを読んでください。コードを拡張可能な形で記述しているので、必要に応じて簡単に変更できます。

以下のコードは、どのスライドやオブジェクトを印刷するのか、どのスライドとオブジェクトを画面上に表示するのかを管理するのに役立ちます。これは、参照スライドを印刷したいが、カバーしない場合に特に便利です。アニメーション付きのスライドがあるときにはさらに便利です。アニメーションは通常、印刷物をうまく翻訳しません。だから、アニメーションオブジェクトを何も印刷しないことを選択します。実際、私は印刷するためだけに使用されるオブジェクト(プレゼンテーション時に隠されている)の代替コンテンツを追加することもできますが、これはめったにありません。代わりに、私は通常、アニメーションを印刷から隠すか、プレゼンテーションするスライドを作成し、アニメーションコピーを印刷用に作成します。これらのマクロを使用すると、印刷用のスライドとオブジェクトとプレゼンテーション用のスライドとオブジェクトのミックスとマッチを簡単に管理できます。楽しんでいただければ幸いです。

Option Explicit 

' DontPresentSlide - run macro while on a slide you wish to skip while presenting. 
'     The slide name will be appended with "NoPresent". You still 
'     need to run PrepToPresent before presenting to hide slide. 
' PresentSlide - "NoPresent" will be removed from the slide. You still 
'    need to run PrepToPresent before presenting to hide slide. 
' PrepToPesentSlides() - Unhide slides and objects you want presented and 
'    hide slides and objects you do NOT want presented. 
' ShowNoPressnt() - show slides and shapes marked "NoPresent" 
' HideNoPresent() - hide slides and shapes marked "NoPresent" 

' DontPrintSlide - run macro while on a slide you wish to skip while presenting. 
'     The slide name will be appended with "NoPrint". You still 
'     need to run PrepToPresent before presenting to hide slide. 
' PrintSlide - "NoPrint" will be removed from the slide. You still 
'    need to run PrepToPresent before presenting to hide slide. 
' PrepToPrintSlides() - Unhide slides and objects you want printed and 
'    hide slides and objects you do NOT want printed. 
' ShowNoPrint() - show slides and shapes marked "NoPrint" 
' HideNoPrint() - hide slides and shapes marked "NoPrint" 

' ShowHideSlides() - Hide or Unhide slides based on slide name. 
' ShowHideShapes() - Hide or Unhide shapes based on shapes name. 


Public Const cjaHide = False 
Public Const cjaShow = True 
Public Const cjaToggle = 2 

Sub ShowHideSlides(NameContains As String _ 
       , Optional LMR As String = "R" _ 
       , Optional ShowSlide As Integer = False) 
' Show or Hide slides based on slide name. 
' Arguements: 
' NameContains (string): 
'  slides with this string will be modified. 
' LMR (string): enter L, M or R to indicate 
'  searching the Left, Middle or Right of 
'  the slide name, respectively. 
' ShowSlide (integer): 
'  Show: True (-1) 
'  Hide: False (0) 
'  Toggle: 2 
' 
' To show or hide slides manually: 
' Right-click the slide thumbnail, then click Hide Slide 
' To rename slides, 
' Use this VBA: ActiveWindow.View.Slide.Name = "NewSlideName" 
' Or, edit the (Name) property in the VBA Properties window. 
' 
    Dim sldCurrent As Slide 
    Dim found As Boolean 
    found = False 

    LMR = Trim(UCase(LMR)) 
    If LMR <> "L" And LMR <> "M" Then LMR = "R" 
    'Loop through each slide in presentation. 
    For Each sldCurrent In ActivePresentation.Slides 
     'Match shape name left, right or middle as per LMR arguement. 
     'ActiveWindow.View.Slide.Name or Slide.SlideNumber 
     found = False 
     If LMR = "R" And LCase(right(sldCurrent.Name, Len(NameContains))) = LCase(NameContains) Then 
      found = True 
     ElseIf LMR = "L" And LCase(left(sldCurrent.Name, Len(NameContains))) = LCase(NameContains) Then 
      found = True 
     ElseIf LMR = "M" And InStr(1, LCase(NameContains), LCase(sldCurrent.Name)) Then 
      found = True 
     End If 
     'If match found, then set shape visibility per ShowShape arguement. 
     If found Then 
      If ShowSlide = True Then 
       ActivePresentation.Slides(sldCurrent.SlideNumber).SlideShowTransition.Hidden = msoFalse 
      ElseIf ShowSlide = False Then 
       ActivePresentation.Slides(sldCurrent.SlideNumber).SlideShowTransition.Hidden = msoTrue 
      Else 
       ActivePresentation.Slides(sldCurrent.SlideNumber).SlideShowTransition.Hidden = Not ActivePresentation.Slides(sldCurrent.SlideNumber).SlideShowTransition.Hidden 
      End If 
     End If 
    Next  'sldCurrent 
End Sub 

Sub ShowHideShapes(NameContains As String _ 
       , Optional LMR As String = "R" _ 
       , Optional ShowShape As Integer = False) 
' Show or Hide shapes/objects based on object name. 
' Arguements: 
' NameContains (string): 
'  shapes with this string will be modified. 
' LMR (string): enter L, M or R to indicate 
'  searching the Left, Middle or Right of 
'  the slide name, respectively. 
' ShowSlide (integer): 
'  Show: True (-1) 
'  Hide: False (0) 
'  Toggle: 2 
' 
' To show, hide and/or rename objects: 
' 1. Turn on Selection Pane via: Home Ribbon > 
'  Select > Selection Pane. 
' 2. Double-click a shape name to rename it. 
' 3. Click the eye icon to the far right to show/hide a shape. 

    Dim shpCurrent As Shape 
    Dim sldCurrent As Slide 
    Dim found As Boolean 
    found = False 

    LMR = Trim(UCase(LMR)) 
    If LMR <> "L" And LMR <> "M" Then LMR = "R" 
    'Loop through each slide in presentation. 
    For Each sldCurrent In ActivePresentation.Slides 
     With sldCurrent 
      'Loop through each shape on current slide. 
      For Each shpCurrent In .Shapes 
      'Match shape name left, right or middle as per LMR arguement. 
      found = False 
      If LMR = "R" And right(shpCurrent.Name, Len(NameContains)) = NameContains Then 
       found = True 
      ElseIf LMR = "L" And left(shpCurrent.Name, Len(NameContains)) = NameContains Then 
       found = True 
      ElseIf LMR = "M" And InStr(1, NameContains, shpCurrent.Name) Then 
       found = True 
      End If 
      'If match found, then set shape visibility per ShowShape arguement. 
      If found Then 
       If ShowShape = True Then 
        shpCurrent.Visible = True 
       ElseIf ShowShape = False Then 
        shpCurrent.Visible = False 
       Else 
        shpCurrent.Visible = Not shpCurrent.Visible 
       End If 
      End If 
      Next 'sldCurrent 
     End With 'sldCurrent 
    Next  'sldCurrent 

End Sub 

Sub HideNoPrint() 
' Hide slides and shapes you do NOT want printed. 
' 
' Run this macro to hide all slides and shapes that 
' end with the string "NoPrint". 

' Usage. Assume you have slides that contain animations that 
' make the printed slide difficult or impossible to read. 
' Let's further suppose you plan to present certain slides 
' but not print them. 
' 1. Add the"NoPrint" suffix to any shapes that clutter 
'  the printed page. 
' 2. Add the "NoPrint" suffix to slides you don't want to 
'  print. 
' 3. Run this macro to hide shapes and slides. 
' 4. Print the slides. 
' 5. Optionally, run the ShowNoPrint() macro in preparation 
'  for presenting the slides. 
    ShowHideShapes "NoPrint", "R", False 
    ShowHideSlides "NoPrint", "R", False 
End Sub 

Sub ShowNoPrint() 
' Unhide slides and shapes that were hidden 
' to prevent them from being printed in handouts. 
' 
    ShowHideShapes "NoPrint", "P", True 
    ShowHideSlides "NoPrint", "P", True 
End Sub 

Sub HideNoPressent() 
' Hide objects you do NOT want to present on screen. 
' 
' Run this macro to hide all slides and shapes that 
' end with the string "NoPresent". 
' 
' Usage. Assume you have slides that contain supporting material 
' that you wish to provide as printed handouts but not show. 
' You can manually hide those slides and objects of course. I 
' prefer to use these macros. 
' 1. Add the"NoPresent" suffix to any shapes that you want 
'  to print to handouts but not show on-screen. 
' 2. Add the "NoPresent" suffix to slides you want to 
'  print but not display on screen, such as reference slides. 
' 3. Run this macro to hide the "NoPresent" shapes and slides. 
' 4. Present your slides. 
' 5. Optionally, run the ShowNoPresent() macro in preparation 
'  for printing the slides. 
' 
    ShowHideShapes "NoPressent", "R", False 
    ShowHideSlides "NoPressent", "R", False 
End Sub 

Sub ShowNoPresent() 
' Unhide objects that were hidden to prevent them from 
' being presented on screen. 
' 
    ShowHideShapes "NoPressent", "P", True 
    ShowHideSlides "NoPressent", "P", True 
End Sub 

Sub PrepToPrintSlides() 
' Unhide objects you want printed and 
' hide objects you do NOT want printed. 
    ShowNoPresent 
    HideNoPrint 
End Sub 

Sub PrepToPresentSlides() 
' Unhide objects you want presented and 
' hide objects you do NOT want presented. 
    ShowNoPrint 
    HideNoPresent 
End Sub 

Sub DontPresentSlide() 
    Dim RetVal, sldName As String 
    sldName = Application.ActiveWindow.View.Slide.Name 
    If InStr(1, sldName, "NoPresent", vbBinaryCompare) = 0 Then 
     RetVal = RenameSlide(sldName, sldName & "-NoPresent") 
    End If 
    HideNoPresent 
End Sub 

Sub PresentSlide() 
    Dim RetVal, sldName As String, strStart As String, newName As String 
    'Remove the NoPresent suffix from the current slide. 

    'get slide name 
    sldName = Application.ActiveWindow.View.Slide.Name 
    'Unhide slide 
    ActivePresentation.Slides(sldName).SlideShowTransition.Hidden = msoFalse 
    'remove "-NoPresent" from slide name 
    Do 
     strStart = InStr(1, sldName, "-NoPresent") 
     If InStr(1, sldName, "-NoPresent") Then 
      newName = left(sldName, strStart - 1) & right(sldName, Len(sldName) - strStart - 9) 
      RetVal = RenameSlide(sldName, newName) 
     End If 
     sldName = Application.ActiveWindow.View.Slide.Name 
    Loop Until InStr(1, sldName, "-NoPresent") = 0 
    'remove "NoPresent" from slide name 
    Do 
     strStart = InStr(1, sldName, "NoPresent") 
     If InStr(1, sldName, "NoPresent") Then 
      newName = left(sldName, strStart - 1) & right(sldName, Len(sldName) - strStart - 8) 
      RetVal = RenameSlide(sldName, newName) 
     End If 
     sldName = Application.ActiveWindow.View.Slide.Name 
    Loop Until InStr(1, sldName, "NoPresent") = 0 

End Sub 

Sub DontPrintSlide() 
    Dim RetVal, sldName As String 
    sldName = Application.ActiveWindow.View.Slide.Name 
    If InStr(1, sldName, "NoPrint", vbBinaryCompare) = 0 Then 
     RetVal = RenameSlide(sldName, sldName & "-NoPrint") 
    End If 
    HideNoPrint 
End Sub 

Sub PrintSlide() 
    Dim RetVal, sldName As String, strStart As String, newName As String 
    'Remove the NoPrint suffix from the current slide. 

    'get slide name 
    sldName = Application.ActiveWindow.View.Slide.Name 
    'Unhide slide 
    ActivePresentation.Slides(sldName).SlideShowTransition.Hidden = msoFalse 
    'remove "-NoPrint" from slide name 
    Do 
     strStart = InStr(1, sldName, "-NoPrint") 
     If InStr(1, sldName, "-NoPrint") Then 
      newName = left(sldName, strStart - 1) & right(sldName, Len(sldName) - strStart - 7) 
      RetVal = RenameSlide(sldName, newName) 
     End If 
     sldName = Application.ActiveWindow.View.Slide.Name 
    Loop Until InStr(1, sldName, "-NoPrint") = 0 
    'remove "NoPrint" from slide name 
    Do 
     strStart = InStr(1, sldName, "NoPrint") 
     If InStr(1, sldName, "NoPrint") Then 
      newName = left(sldName, strStart - 1) & right(sldName, Len(sldName) - strStart - 6) 
      RetVal = RenameSlide(sldName, newName) 
     End If 
     sldName = Application.ActiveWindow.View.Slide.Name 
    Loop Until InStr(1, sldName, "NoPrint") = 0 
End Sub 

Sub HideAllCovers() 
' Run this macro to hide all Covers. 
    ShowHideShapes "Cover", "L", False 
End Sub 

Sub ShowAllCovers() 
' Run this macro to hide all Covers. 
    ShowHideShapes "Cover", "L", True 
End Sub 

Sub HideAllAnswers() 
' Run this macro to hide all Covers. 
    ShowHideShapes "Answer", "L", False 
End Sub 

Sub ShowAllAnswers() 
' Run this macro to hide all Covers. 
    ShowHideShapes "Answer", "L", True 
End Sub 

Sub HideAllQuestions() 
' Run this macro to hide all Covers. 
    ShowHideShapes "Question", "L", False 
End Sub 

Sub ShowAllQuestions() 
' Run this macro to hide all Covers. 
    ShowHideShapes "Question", "L", True 
End Sub 

Sub ShowAll() 
' Run this macro to hide all shapes (Covers and Answers). 
    ShowAllQuestions 
    ShowAllAnswers 
    ShowAllCovers 
    ShowNoPrint 
End Sub 

Sub HideAll() 
' Run this macro to hide all shapes (Covers and Answers). 
    HideAllQuestions 
    HideAllAnswers 
    HideAllCovers 
    HideNoPrint 
End Sub 
関連する問題