Skip to content
TheChatArchiveThe Chat Archive
gpt-4-1106-preview· OpenAIAi2 WildChat-4.8M (AI2)

Write me a VBA code for powerpoint slides about jQuery using the following theory text:…

  1. User

    Write me a VBA code for powerpoint slides about jQuery using the following theory text: BASE EN JSQUERY
    -Insérer et remplacer des éléments dans le DOM Nous allons ici nous intéresser à une autre facette de jQuery : la modification du DOM. Les méthodes qui vont être examinées permettent d'insérer, de remplacer et de supprimer des éléments quelconques dans le DOM, et ainsi de modifier le contenu de la page affichée dans le navigateur. Insérer du contenu Toutes les méthodes passées en revue dans cette section seront testées sur le code suivant : Code : HTML

  2. Assistant

    The following VBA code creates PowerPoint slides for a presentation about jQuery. It takes the provided theoretical text and places each section into a separate slide. Note that the code assumes you have a PowerPoint instance open, and it creates a new presentation.

    Sub CreatejQueryPresentation()
        ' Declare PowerPoint variables
        Dim pptApp As Object
        Dim pptPres As Object
        Dim pptSlide As Object
        Dim i As Integer
        
        ' Reference existing PowerPoint instance or create a new one
        On Error Resume Next
        Set pptApp = GetObject(, "PowerPoint.Application")
        If pptApp Is Nothing Then Set pptApp = CreateObject("PowerPoint.Application")
        On Error GoTo 0
        
        ' Create a new PowerPoint presentation
        Set pptPres = pptApp.Presentations.Add
        pptApp.Visible = True
        
        ' Slide Titles and associated content
        Dim slideTitlesAndContent As Variant
        slideTitlesAndContent = Array( _
            Array("Introduction à jQuery et Manipulation du DOM", _
                  "Nous allons nous intéresser à la manipulation du DOM avec jQuery." & vbCrLf & _
                  "Les méthodes permettent d'insérer, de remplacer et de supprimer des éléments dans le DOM." & vbCrLf), _
            Array("Insérer du contenu", _
                  "Methodes: append(), prepend(), before(), after()." & vbCrLf & _
                  "Exemples:" & vbCrLf & _
                  "$('h2').append(' ***');" & vbCrLf & _
                  "$('h2').prepend('*** ');" & vbCrLf & _
                  "$('#trois').before('<hr>');" & vbCrLf & _
                  "$('hr').after('</br></br>');" & vbCrLf), _
            Array("Remplacer des éléments", _
                  "Méthode: replaceWith()." & vbCrLf & _
                  "Exemple:" & vbCrLf & _
                  "$('hr').replaceWith('</br>');" & vbCrLf & _
                  "$('h2').each() pour remplacer avec une balise differente." & vbCrLf), _
            Array("Insérer des éléments dans le DOM", _
                  "Methodes: appendTo(), prependTo(), insertBefore(), insertAfter()." & vbCrLf & _
                  "Exemple:" & vbCrLf & _
                  "$('<li>Deuxième élément bis</li>').insertAfter($('li:nth-child(2)'));" & vbCrLf), _
            Array("Déplacer du contenu", _
                  "Méthodes: append(), prepend(), before(), after()." & vbCrLf & _
                  "Exemple:" & vbCrLf & _
                  "$('#deux').after($('#un'));" & vbCrLf), _
            Array("Dupliquer des éléments", _
                  "Méthode: clone()." & vbCrLf & _
                  "Exemple:" & vbCrLf & _
                  "$('#deux').clone().insertBefore($('#un'));" & vbCrLf), _
            Array("Entourer des éléments", _
                  "Methodes: wrap(), wrapInner(), wrapAll()." & vbCrLf & _
                  "Exemple:" & vbCrLf & _
                  "$('li').wrap('<i></i>');" & vbCrLf), _
            Array("Supprimer des éléments", _
                  "Méthode: remove()." & vbCrLf & _
                  "Exemple:" & vbCrLf & _
                  "$('h2').remove();" & vbCrLf & _
                  "$('li:nth-child(2)').remove();" & vbCrLf & _
                  "$('p:contains(\"quelconque\")').remove();" & vbCrLf) _
        )
        
        ' Add slides and content to PowerPoint
        For i = LBound(slideTitlesAndContent) To UBound(slideTitlesAndContent)
            ' Add a new slide to the presentation
            Set pptSlide = pptPres.Slides.Add(i + 1, ppLayoutText)
            
            ' Set the title and content for each slide
            pptSlide.Shapes(1).TextFrame.TextRange.Text = slideTitlesAndContent(i)(0)
            pptSlide.Shapes(2).TextFrame.TextRange.Text = slideTitlesAndContent(i)(1)
        
            ' Format slide content
            With pptSlide.Shapes(2).TextFrame.TextRange
                .ParagraphFormat.Alignment = ppAlignLeft
                .Font.Name = "Consolas"
                .Font.Size = 12
                .Paragraphs.ParagraphFormat.Bullet.Type = ppBulletNone
            End With
        Next i
    
        ' End the PowerPoint presentation
        pptApp.Activate
        MsgBox "jQuery presentation created!", vbInformation
    End Sub
    

    To run the code, press ALT + F11 to open the Visual Basic for Applications editor in PowerPoint, create a new module, paste the code, and then run the CreatejQueryPresentation subroutine.

    Please note that the VBA code outlined above assumes a basic layout with a title and text content. The code samples from jQuery have been placed within the text body as-is. Adjustments may be needed depending on the desired presentation style and structure.

Responses were produced in different, uncontrolled contexts (system prompts, settings, prior turns). This is not a benchmark.