Question

MESSAGE 1 1. Using the Visual Basic Editor, create a VBA procedure named message_1 that does...

MESSAGE 1

1. Using the Visual Basic Editor, create a VBA procedure named message_1 that does the following:
a. Asks the user for their name (using an Input Box).
b. Determines the number of slides in the presentation using the appropriate code.
c. Displays a message back to the user (using a Message Box) that contains the name entered and the number of slide in the presentation. The message should be something like this: (Hello Sally, there are 8 slides in this presentation!)

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Below is the VBA code that will ask the user for name, then count the number of slides is the presentation given as path and output the result. In order to use PowerPoint presentation object you need to add the object. Follow the instruction below to add object-

1. Go to Tools -> Reference then from the dialog box check Microsoft PowerPoint 16.0 Object Libarary

2. Click ok.

Then copy paste the below code. Follow the comments for understanding.

VBA Code-

Sub message_1()
' Getting user name as input
myName = InputBox("Enter your name")
' Code to give file path to count number of slides in PPT
Dim pPath As String
Dim pCount As Integer
Dim pPowerPoint As New PowerPoint.Application
Dim pPresentation As PowerPoint.Presentation

'Full Path of your Power point presentation
pPath = ".\Team Meeting-agenda.pptx" 'For example
Set pPresentation = pPowerPoint.Presentations.Open(pPath)

'Get the total count of slides
pCount = pPresentation.Slides.Count

pPresentation.Close 'Close the power point presentation
pPowerPoint.Quit 'now quit the power point Application

'Set both the Object variables to Nothing
Set pPresentation = Nothing
Set pPowerPoint = Nothing
'Display message with total count
MsgBox "Hello " & myName & ", There are " & pCount & " slides in this presentation"

End Sub

Code screenshot-

Output (1)

Output (2)

Add a comment
Answer #2

Any doubt please comment me.

Answer)

I create a presentation with four slides and on the first slide I take a button, then write the code of VBA against that button. When the slide show start we will click on the button. single quotes(') is used for comments.

The code

Private Sub CommandButton1_Click()

'inputbox to Asks the user for their name
i = InputBox("Name", "Name", , 1, 1)
'ActivePresentation.Slides.Count is used to Determines the number of slides in the presentation
p = ActivePresentation.Slides.Count
'msgbox to display the message, and display the count, & is used for concatenation
MsgBox ("Hello " & i & ", there are " & p & " slides in this presentation!")
End Sub

Screenshot before presentation starts.

Screenshot after presentation starts. Click on the button

Add a comment
Know the answer?
Add Answer to:
MESSAGE 1 1. Using the Visual Basic Editor, create a VBA procedure named message_1 that does...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Using powerpoint VBA, Using the Visual Basic Editor, create a VBA procedure named message_2 that does...

    Using powerpoint VBA, Using the Visual Basic Editor, create a VBA procedure named message_2 that does the following:Create a Message Box that meets the following requirements: A Multiline Message Box with the following message: Welcome to PowerPoint! Do you wish to run this Presentation? Contains a Yes and a No button. Contains a Question Mark icon. The No button is the default button. The Message Box title reads "Run Show?". If the user clicks the Yes button, the slide show...

  • Create and call a function Using the Visual Basic Editor: create a VBA procedure named call_function...

    Create and call a function Using the Visual Basic Editor: create a VBA procedure named call_function that does the following: Prompts the user, using two input boxes, for the height and the radius of the base of a cone. Calls a function named cone_volume and passes the two values to it. Receives a value back from the function and displays it in a message to the user. Create a function named cone_volume that does the following: Receives the two values...

  • 1 CREATE A DOCUMENT (USE CHAPTER 20 FOR REFERENCE) 1. Using the Visual Basic Editor, create...

    1 CREATE A DOCUMENT (USE CHAPTER 20 FOR REFERENCE) 1. Using the Visual Basic Editor, create a VBA procedure named doc_create that does the following: a. Creates a new Word document. b. Adds 1 line of text that says “This is my document!” c. Saves the file as myFile.docx d. Closes the document.

  • PLEASE USE VISUAL BASIC* BY VISUAL STUDIO. Visual Basic INTERMEDIATE Create a Windows Forms application. Use...

    PLEASE USE VISUAL BASIC* BY VISUAL STUDIO. Visual Basic INTERMEDIATE Create a Windows Forms application. Use the following names for the project and solution, respectively: Chopkins Project and Chopkins Solution. Save the application in the VB2017\Chap03 folder. Change the form file's name to Main Form.vb. Change the form's name to frmMain. Create the interface shown in Figure 3-37. The interface contains six labels, three text boxes, and two buttons. The application calculates and displays the total number of packs ordered...

  • Microsoft Excel VBA (Visual Basic for Applications) Programming Language Objectives: Create an array and redim it...

    Microsoft Excel VBA (Visual Basic for Applications) Programming Language Objectives: Create an array and redim it to a size equal to an assigned value of a variable, populate the array with a series of random numbers, output the array to a message box and to a worksheet. Instructions: - Review the variables already declared. You won't need others. - See comments in the code that will act as your guide. Add new code directly after each comment. - Assign a...

  • Problem 1 - Print positive message Create a new project named whatever you want in Visual...

    Problem 1 - Print positive message Create a new project named whatever you want in Visual Studio using the Windows Desktop Wizard or in Xcode. If you're using Visual Studio, add a main.c file to your project; you can use the main.c template I provided on Canvas if you'd like. If you're using Xcode, Xcode automatically generates a main.c file for you. Read in an integer from the user; don't prompt for the user input, because that will confuse the...

  • in visual basic ........Create a project that displays the aisle number of a movie category in...

    in visual basic ........Create a project that displays the aisle number of a movie category in a label. The movie categories will be in a list box. Store the aisle numbers and categories in an array. A Search button should locate the correct location from the array and display it in a label. Make sure that the user has selected a category from the list and use the list box SelectedIndex property to find the appropriate aisle number. Table Data...

  • the code is in visual basic 376 Chapter 6 Loop Structures Case Programming Assignments con Most...

    the code is in visual basic 376 Chapter 6 Loop Structures Case Programming Assignments con Most Rainfall in the USA USE CASE DEFINITION e Windows application opens with the heading "Most Rainfall in US - Kauai," a ListBox object that displays the monthly rainfall amounts, an i amounts in inches mage, and a Button object that allows the user to begin entering their rainfall 2. A menu bar displays the File menu, which has two menu items: Clear and Exit....

  • This is Visual Basic program, thank you for your help In this assignment, you'll start a...

    This is Visual Basic program, thank you for your help In this assignment, you'll start a new Windows Forms application. Assume we have the data shown below: Names_first={"jack","marjy","tom","luke","sam","al","joe","miky","lu"} Name_last={"jones","ety","fan","spence","amin",sid","bud","ant","ben"} Amounts={234.45,8293.1,943.25,27381.0,271.39,7436.12,2743.0,1639.95,2354.2} The above will allows us to emulate reading data from a file, which we will learn in the next unit. For now, we will assume the data above has been read from a file. We need to process this data in fast way. For that purpose, we need to: Declare...

  • this is assembly language for x-86 processors using microsoft visual studio Create a procedure named FindThrees...

    this is assembly language for x-86 processors using microsoft visual studio Create a procedure named FindThrees that returns 1 if an array has three consecutive values of 3 somewhere in the array. Otherwise, return 0. The procedure’s input parameter list contains a pointer to the array and the array’s size. Use the PROC directive with a parameter list when declaring the procedure. Preserve all registers (except EAX) that are modified by the procedure. Write a test program that calls FindThrees...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT