Propósito

✔ Programação GLOBAL® - Quaisquer soluções e/ou desenvolvimento de aplicações pessoais, ou da empresa, que não constem neste Blog devem ser tratados como consultoria freelance. Queiram contatar-nos: brazilsalesforceeffectiveness@gmail.com | ESTE BLOG NÃO SE RESPONSABILIZA POR QUAISQUER DANOS PROVENIENTES DO USO DOS CÓDIGOS AQUI POSTADOS EM APLICAÇÕES PESSOAIS OU DE TERCEIROS.

.: Vitrine

Carregando artigos...

Views

Mostrando postagens com marcador Notes. Mostrar todas as postagens
Mostrando postagens com marcador Notes. Mostrar todas as postagens

VBA Powerpoint - Converta os textos dos Slides para Notas de Comentários - Convert PowerPoint TextBox Slides as Notes



Documentar as apresentações que preparamos é muito importante, e confesse, a maioria de nós nunca fazemos isso.

Mas imagine que pudéssemos automaticamente copiar os conteúdos das nossas Caixas de Texto como Notas de comentário nos Slides da nossa apresentação? Isso seria muito produtivo!

Pois então, agora podemos fazer isso:

Sub ExportTextBox_AsNotes() 
Dim oPPT As Presentation 
Dim oSlide As Slide 
Dim oSlideShape As Shape 
Dim oNotesShape As Shape 

Set oPPT = ActivePresentation 
Set oSlide = oPPT.Slides(3) 

For Each oSlideShape In oSlide.Shapes 
If oSlideShape.HasTextFrame Then 
Set oNotesShape = oSlide.NotesPage.Shapes.AddShape(msoShapeRectangle, 54, 442, 432, 324) ' 

oNotesShape.TextFrame.TextRange.Text = oSlideShape.TextFrame.TextRange.Text 
End If 
Next 

If Not oSlide Is Nothing Then Set oSlide = Nothing 
If Not oPPT Is Nothing Then Set oPPT = Nothing 
End Sub


Deixe os seus comentários! Envie este artigo, divulgue este link na sua rede social...


Tags: VBA, Notes, PowerPoint, Automate, Extract, Slides, TextBox


VBA Powerpoint - Liste os Títulos e as Notas dos seus Slides - How to get a list of the slide titles and notes text in PowerPoint?












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 Boolean

Sub ExportNotesText()

    Dim oSlides As Slides
    Dim oSl As Slide
    Dim oSh As Shape
    Dim strNotesText As String
    Dim strFileName As String
    Dim intFileNum As Integer
    Dim lngReturn As Long
    Dim results As VbMsgBoxResult    
    
    ' Get a filename to store the collected text
    strFileName = 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 Then
        fOnlyEmptyNotes = True
        strNotesText = strNotesText & _
            "IMPORTANT:  This file contains only the slides that have Notes!" & vbCrLf & vbCrLf
    Else
        fOnlyEmptyNotes = False
    End If      

    ' did user cancel?
    If strFileName = "" Or results = vbCancel Then
        Exit Sub
    End If

    ' is the path valid?  crude but effective test:  try to create the file.
    intFileNum = FreeFile()
    On Error Resume Next
    Open strFileName For Output As intFileNum
    If Err.Number <> 0 Then     ' we have a problem
        MsgBox "Couldn't create the file: " & strFileName & vbCrLf _
            & "Please try again."
        Exit Sub
    End If
    Close #intFileNum  ' temporarily

    ' Get the notes text
    Set oSlides = ActivePresentation.Slides
    
    For Each oSl In oSlides
        If fOnlyEmptyNotes = True Then
            ' Only output notes for slides with actual note text
            If NotesText(oSl) <> vbNullString Then
                strNotesText = strNotesText & "-----------------------------------" & vbCrLf
                strNotesText = strNotesText & "TITLE:  " & SlideTitle(oSl) & vbCrLf
                strNotesText = strNotesText & "NUMBER: " & oSl.SlideNumber & vbCrLf
                strNotesText = strNotesText & "NOTES:  " & NotesText(oSl) & vbCrLf & vbCrLf
            End If
        Else
            ' Output all slides
            strNotesText = strNotesText & "-----------------------------------" & vbCrLf
            strNotesText = strNotesText & "TITLE:  " & SlideTitle(oSl) & vbCrLf
            strNotesText = strNotesText & "NUMBER: " & oSl.SlideNumber & vbCrLf
            strNotesText = strNotesText & "NOTES:  " & NotesText(oSl) & vbCrLf & vbCrLf
        End If
        
    Next oSl

    ' now write the text to file
    Open strFileName For Output As intFileNum
    Print #intFileNum, strNotesText
    Close #intFileNum

    ' show what we've done
    lngReturn = Shell("NOTEPAD.EXE " & strFileName, vbNormalFocus)

End Sub

Function SlideTitle (oSl As Slide) As String
    Dim oSh As Shape
    For Each oSh In oSl.Shapes
        If oSh.Type = msoPlaceholder Then
            If oSh.PlaceholderFormat.Type = ppPlaceholderTitle _
                Or oSh.PlaceholderFormat.Type = ppPlaceholderCenterTitle Then
                If Len(oSh.TextFrame.TextRange.Text) > 0 Then
                    SlideTitle = oSh.TextFrame.TextRange.Text
                Else
                    SlideTitle = "Slide " & CStr(oSl.SlideIndex)
                End If
                Exit Function
            End If
        End If
    Next
End Function

Function NotesText (oSl As Slide) As String
' Only looking for Shape.Type = PlaceHolder which contains notes
    Dim oSh As Shape
    
    For Each oSh In oSl.NotesPage.Shapes
        If oSh.Type = msoPlaceholder Then
            If oSh.PlaceholderFormat.Type = ppPlaceholderBody Then
                If oSh.HasTextFrame Then
                    If oSh.TextFrame.HasText Then
                        NotesText = oSh.TextFrame.TextRange.Text
                    End If
                End If
            Else
                NotesText = vbNullString
            End If
        End If
    Next oSh
    
End Function


Tags: VBA, Powerpoint, list, slide, titles, notes


VBA LOTUS NOTES DOMINO - Código de envio de e-mails

Algumas pessoas no ano passado e já neste ano solicitaram código sobre como enviar e-mail no Lotus Notes Domino.

Seguem possibilidades de fazê-lo. Como sempre, divirtam-se:


Public Sub EnviarMailViaNotes (Subject As String, Attachment As String, Recipient As String, BodyText As String, SaveIt As Boolean)

    Dim Maildb As Object
    Dim UserName As String 
    Dim MailDbName As String 
    Dim MailDoc As Object
    Dim AttachME As Object 
    Dim Session As Object 
    Dim EmbedObj As Object 

    Set Session = CreateObject("Notes.NotesSession")

    Session.Initialize("password")
   
    Let UserName = Session.UserName
    
    Let MailDbName = Left$(UserName, 1) & Right$(UserName, (Len(UserName) - InStr(1, UserName, " "))) & ".nsf"
    
    Set Maildb = Session.GETDATABASE("", MailDbName)
     If Maildb.ISOPEN = True Then
          
     Else
         Maildb.OPENMAIL
     End If
    
    Set MailDoc = Maildb.CREATEDOCUMENT
    
    Let MailDoc.Form = "Memo"    
    Let MailDoc.sendto = Recipient
    Let MailDoc.Subject = Subject    
    Let MailDoc.Body = BodyText    
    Let MailDoc.SAVEMESSAGEONSEND = SaveIt
    
    If Attachment <> "" Then
        Set AttachME = MailDoc.CREATERICHTEXTITEM("Attachment")
        Set EmbedObj = AttachME.EMBEDOBJECT(1454, "", Attachment, "Attachment")
        MailDoc.CREATERICHTEXTITEM ("Attachment")
    End If
    
    
    Let MailDoc.PostedDate=Now() 
    MailDoc.SEND 0, Recipient
    
    Set Maildb = Nothing
    Set MailDoc = Nothing
    Set AttachME = Nothing
    Set Session = Nothing
    Set EmbedObj = Nothing
End Sub

Se desejar enviar o e-mail para mais de uma pessoa, Let MailDoc.sendto = Recipient
Let MailDoc.CopyTo = ccRecipientLet MailDoc.BlindCopyTo = bccRecipient

Se desejar enviar para múltiplos e-mails, que tenham sido carregados num vetor,
Dim recip(25) as variant
Let recip(0) = "emailaddress1"
Let recip(1) = "emailaddress2" e.t.c
Let maildoc.sendto = recip

OUTRO MODO
Sub SendMailAttachment () 
    Dim strBOdocument As String 
    Dim strBOUserDocsPath As String 
    
    Let strBOUserDocsPath = busobj.ActiveDocument.Path & "\" 
    
    
    Let strBOdocument = Application.ActiveDocument.Name 
    
    Application.ActiveDocument.SaveAs (strBOUserDocsPath & strBOdocument & ".xls")    
    Dim domSession As New NotesSession 
    Dim domNotesDBMailFile As NotesDatabase 
    Dim domNotesDocumentMemo As NotesDocument 
    Dim domNotesRichText As NotesRichTextItem 
    Dim strAttachment As String 
    
    domSession.Initialize ("")
    
    Set domNotesDBMailFile = domSession.GetDatabase("", "names.nsf") 
    Set domNotesDocumentMemo = domNotesDBMailFile.CreateDocument 
    
    Call domNotesDocumentMemo.AppendItemValue("Form", "Memo") 
    Call domNotesDocumentMemo.AppendItemValue("SendTo", domSession.CommonUserName) 
    Call domNotesDocumentMemo.AppendItemValue("Subject", strBOdocument) 
    
    Set domNotesRichText = domNotesDocumentMemo.CreateRichTextItem("Body") 
    
    strAttachment = strBOUserDocsPath & strBOdocument & ".xls" 
    
    Call domNotesRichText.EmbedObject(EMBED_ATTACHMENT, "", strAttachment, "") 
    
    domNotesRichText.AppendText (InputBox("Digite algum texto adicional que deseje acrescentar.", _ 
    " Este aparecerá no corpo do e-mail.")) 
    
    domNotesDocumentMemo.Send (False) 
End Sub

Evoque-o assim:
Private Sub Document_AfterRefresh() 
    ThisDocument.ExecuteMacro ("SendMailAttachment") 
End Sub 

Private Sub Document_AfterRefresh() 
    SendMailAttachment 
End Sub

Tags: Bernardes, VBA, Office, e-Mail, Send, Mail, Lotus, Notes, Domino, Attachment, Recipient, CCo, Bco, CC





André Luiz Bernardes
A&A® - Work smart, not hard.

diHITT - Notícias