Skip to content
TheChatArchiveThe Chat Archive
gpt-3.5-turbo-0613· OpenAIAi2 WildChat-4.8M (AI2)

Module 2 - The Firm and its Goals.ppt “Chapter 2 - The Firm and Its Goals” create VBA…

  1. User

    Module 2 - The Firm and its Goals.ppt “Chapter 2 - The Firm and Its Goals” create VBA code for a PowerPoint Presentation - Company Goals and Profit

  2. Assistant

    Sub GenerateCompanyGoalsAndProfitPresentation()

    ' Define variables
    Dim pptApp As PowerPoint.Application
    Dim pptPres As PowerPoint.Presentation
    Dim pptSlide As PowerPoint.Slide
    Dim pptShape As PowerPoint.Shape
    Dim goals As Object
    Dim profit As Double
    
    ' Set goals and profit data
    Set goals = Array("Increase market share", "Improve customer satisfaction", "Expand product line", "Increase profitability")
    profit = 1000000 ' Insert actual profit value here
    
    ' Create PowerPoint application
    Set pptApp = New PowerPoint.Application
    pptApp.Visible = True
    
    ' Create new presentation
    Set pptPres = pptApp.Presentations.Add
    
    ' Add slides with company goals
    For Each goal In goals
        ' Add new slide
        Set pptSlide = pptPres.Slides.Add(pptPres.Slides.Count + 1, ppLayoutText)
        
        ' Set title
        Set pptShape = pptSlide.Shapes.Title
        pptShape.TextFrame.TextRange.Text = "Company Goal"
        
        ' Set goal text
        Set pptShape = pptSlide.Shapes.AddTextbox(msoTextOrientationHorizontal, 50, 100, 500, 300)
        pptShape.TextFrame.TextRange.Text = goal
    Next goal
    
    ' Add slide with profit information
    Set pptSlide = pptPres.Slides.Add(pptPres.Slides.Count + 1, ppLayoutTitleOnly)
      
    ' Set title
    Set pptShape = pptSlide.Shapes.Title
    pptShape.TextFrame.TextRange.Text = "Profit"
      
    ' Set profit value
    Set pptShape = pptSlide.Shapes.AddTextbox(msoTextOrientationHorizontal, 50, 100, 500, 300)
    pptShape.TextFrame.TextRange.Text = "Profit: $" & Profit
    
    ' Clean up
    Set pptApp = Nothing
    Set pptPres = Nothing
    Set pptSlide = Nothing
    Set pptShape = Nothing
    

    End Sub