| Blog Office VBA | Blog Excel | Blog Access | Blog Infochart |
Tópicos relacionados:
Envie um email sem o aviso de segurança
Como enviar um email com uma assinatura dinâmica
Anexando arquivo ao email
Avalia o endereço do email
Como criar um código no Outlook
Pesquise todos os emails no Outlook e extraia informações
Anexando arquivo ao email
Avalia o endereço do email
Como criar um código no Outlook
Pesquise todos os emails no Outlook e extraia informações
Enviando E-mail sem o aviso de segurança
Enviando e-mails a partir do Excel
Como exportar as tarefas do MS Outlook para o MS Excel
LOTUS NOTES DOMINO - Código de envio de emails
Como obter uma lista dos títulos de slides e notas de texto no PowerPoint?
Execute a "difícil" tarefa de colar o código abaixo em um novo módulo e o execute para obter uma lista de todos os Títulos e Notas da sua apresentação.
Option Explicit
Dim fOnlyEmptyNotes As BooleanSub ExportNotesText()Dim oSlides As SlidesDim oSl As SlideDim oSh As ShapeDim strNotesText As StringDim strFileName As StringDim intFileNum As IntegerDim lngReturn As LongDim results As VbMsgBoxResult' Get a filename to store the collected textstrFileName = Replace(ActivePresentation.FullName, ".ppt", ".txt")strFileName = InputBox("Enter the full path and name of file to extract notes text to", "Output file?", strFileName)strNotesText = "Slide Notes from PowerPoint presentation:" & vbCrLf & _ActivePresentation.FullName & vbCrLf & vbCrLf' Include only slides with notes in output file?results = MsgBox("Would you like to ONLY include Slides that actually have Notes in your output file?", _vbQuestion + vbYesNoCancel, "Output Results")If results = vbYes ThenfOnlyEmptyNotes = TruestrNotesText = strNotesText & _"IMPORTANT: This file contains only the slides that have Notes!" & vbCrLf & vbCrLfElsefOnlyEmptyNotes = FalseEnd If' did user cancel?If strFileName = "" Or results = vbCancel ThenExit SubEnd If' is the path valid? crude but effective test: try to create the file.intFileNum = FreeFile()On Error Resume NextOpen strFileName For Output As intFileNumIf Err.Number <> 0 Then ' we have a problemMsgBox "Couldn't create the file: " & strFileName & vbCrLf _& "Please try again."Exit SubEnd IfClose #intFileNum ' temporarily' Get the notes textSet oSlides = ActivePresentation.SlidesFor Each oSl In oSlidesIf fOnlyEmptyNotes = True Then' Only output notes for slides with actual note textIf NotesText(oSl) <> vbNullString ThenstrNotesText = strNotesText & "-----------------------------------" & vbCrLfstrNotesText = strNotesText & "TITLE: " & SlideTitle(oSl) & vbCrLfstrNotesText = strNotesText & "NUMBER: " & oSl.SlideNumber & vbCrLfstrNotesText = strNotesText & "NOTES: " & NotesText(oSl) & vbCrLf & vbCrLfEnd IfElse' Output all slidesstrNotesText = strNotesText & "-----------------------------------" & vbCrLfstrNotesText = strNotesText & "TITLE: " & SlideTitle(oSl) & vbCrLfstrNotesText = strNotesText & "NUMBER: " & oSl.SlideNumber & vbCrLfstrNotesText = strNotesText & "NOTES: " & NotesText(oSl) & vbCrLf & vbCrLfEnd IfNext oSl' now write the text to fileOpen strFileName For Output As intFileNumPrint #intFileNum, strNotesTextClose #intFileNum' show what we've donelngReturn = Shell("NOTEPAD.EXE " & strFileName, vbNormalFocus)End SubFunction SlideTitle (oSl As Slide) As StringDim oSh As ShapeFor Each oSh In oSl.ShapesIf oSh.Type = msoPlaceholder ThenIf oSh.PlaceholderFormat.Type = ppPlaceholderTitle _Or oSh.PlaceholderFormat.Type = ppPlaceholderCenterTitle ThenIf Len(oSh.TextFrame.TextRange.Text) > 0 ThenSlideTitle = oSh.TextFrame.TextRange.TextElseSlideTitle = "Slide " & CStr(oSl.SlideIndex)End IfExit FunctionEnd IfEnd IfNextEnd FunctionFunction NotesText (oSl As Slide) As String' Only looking for Shape.Type = PlaceHolder which contains notesDim oSh As ShapeFor Each oSh In oSl.NotesPage.ShapesIf oSh.Type = msoPlaceholder ThenIf oSh.PlaceholderFormat.Type = ppPlaceholderBody ThenIf oSh.HasTextFrame ThenIf oSh.TextFrame.HasText ThenNotesText = oSh.TextFrame.TextRange.TextEnd IfEnd IfElseNotesText = vbNullStringEnd IfEnd IfNext oShEnd Function
Nenhum comentário:
Postar um comentário